Log in

View Full Version : Server Status??


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

Akkadius
05-12-2013, 03:34 PM
Zamthos,

That snippet of code is only going to do you any good on a Linux system.

If you want to make a way to show the server is online, I suggest a way of either

A) Parsing the Server List Page on EQEmulator for your needs...
B) Telnetting into port 9000 (World Server) of your server and pulling the information that you want through the telnet console. This will require you to have PHP telnet client to do this or Perl CGI Telnet client. Perl's telnet client is superb but then you also have to figure out how to use CGI for web servers.