I am writing a control panel for a gamehost using PHP, which calls a bash script (which wraps around another) to control game servers

Right now once the bash scripts are running the PHP script that called them is unavailable for any more users, and if apache is restarted the bash script is killed

Is it possible to do as I want using PHP?

Here's the code so far:

[the php file]

case "start": exec('bash -c "exec nohup ./run2 > /dev/null 2>&1 &"');

[run2 - bash]
#!/bin/sh
nohup /home/clanbase/cbrun&
echo $! > /home/clanbase/script.pid

[cbrun - bash]
#!/bin/sh
if [ -z $(pidof cbmohaa) ]
then
nohup /home/clanbase/MOHAA/./cbmohaa +set net_ip 82.136.18.132 +set net_port 12208 +exec server.cfg > /dev/null 2>&1 &
echo $! > /home/clanbase/server.pid
fi
nohup sleep 15
exec $0


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to