I want to be able to display on my web page whether or not a process is running. Both run on the same system (Ubuntu server).
Basically, if something like the command ps -u game | grep java returns something, I want the site to display something like “Game Server Online”, else “Offline.”
I figure I could redirect the grep output to a file every 5 mins and have a script on the main page read the file content as a string to determine what to print. I feel as though there is be a much better way to do this, however. What else could I do and which scripting language would be best for this task?
If php is available, you could do something like this inline in your page: