2

I am trying to figure out if a gameserver is running. I found a lot of dirty methods so I wanted to make it basically easy by calling a PHP script which checks if a process is running. Well what I was trying was:

<?php
exec("bin_unix/linux_server", $output, $return);
if ($return == 0) {
    echo "Ok, process is running\n";
} else {
    echo "Process is not running\n";
}

but its not working (since I am sure the process is running).. its not a "real" process don't blame me I am not an linux expert.

So what I do to run this server is the following command:

cd /path/to/server/ && nohup bin_unix/linux_server &

I guess the bin_unix/linux_server in the exec(); is wrong, but its the only static information I get with ps aux.

The process_id will change often so I am not sure what to type there..

1 Answer 1

1

use pidof command, look here: pidof command

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.