var/ipaddress="127.0.0.1"
var/port="1709"
var/serverpath="~/byond/MyHub/dmu/dmu.dmb"
var/serveroptionals="-trusted"
world/New()
world.log=file("Monitorlog.txt");
Check_Server()
proc
Check_Server()
var/failattempts = 0
LOOP
var/SERVER = world.Export("[ipaddress]:[port]?ping")
if(!SERVER)
world.log<<"<[time2text(world.timeofday)]> Server failed to respond"
failattempts++;
if(failattempts>2)
world.log<<"<[time2text(world.timeofday)]> Reboot Attempted"
world.log<<"----------------------"
startup(serverpath,port,serveroptionals)
failattempts=0;
spawn(10)
goto LOOP
Problem description:
This code works perfectly fine on Windows.
However, neither logging output or running of a server works on a Linux machine.
Any ideas?
FYI. It's using variables because I plan to make it use an external txt file to obtain this information when I know it works solid.
In all likelyhood, serverpath needs to be an absolute path (or a relative path that doesn't use ~).
Also, once you have a proper response from the server (eg, get a ping response), you should probably set failedattempts to 0.