Zamthos
05-12-2013, 12:47 PM
I have looked to find out how to call whether the server is online or offline, I have been successful in finding something that may do the trick, but it says the server is Offline even though it is online, and it still pulls the player information, code below.
<?php
if (exec("ps -A | grep world") == "")
echo "<img src=\"./down.jpg\"</img>";
else
echo "<img src=\"./up.jpg\"</img>";
fi
?>
<?php
echo exec("mysql -H -u USER --password=PASSWORD-D DATABASE -e \"select distinct character_.name as Name, long_name as Zone from zone, character_, character_backup where zone.zoneidnumber = character_.zoneid and character_.name = character_backup.name AND ts > current_timestamp() - interval 1 hour ORDER BY ts;\"");
?>
EDIT: Could it be that it's checking for the world process and setting it as Down if it is there? This code is from an old 2007 post. http://www.eqemulator.org/forums/showthread.php?t=23559&highlight=server+online+button
<?php
if (exec("ps -A | grep world") == "")
echo "<img src=\"./down.jpg\"</img>";
else
echo "<img src=\"./up.jpg\"</img>";
fi
?>
<?php
echo exec("mysql -H -u USER --password=PASSWORD-D DATABASE -e \"select distinct character_.name as Name, long_name as Zone from zone, character_, character_backup where zone.zoneidnumber = character_.zoneid and character_.name = character_backup.name AND ts > current_timestamp() - interval 1 hour ORDER BY ts;\"");
?>
EDIT: Could it be that it's checking for the world process and setting it as Down if it is there? This code is from an old 2007 post. http://www.eqemulator.org/forums/showthread.php?t=23559&highlight=server+online+button