Thank you for your responses,
I have not yet attempted to have PHP perform all the functions of the shellscript...
however one of the lines inside the Shellscript is an executution of the main 'soldatserver' anyways, and produces the same result (php hanging) as it does trying to run the shellscript would.
(I have tried having system(ls -l); and it outputted the ls command just fine and did not hang)
When I do debugging, I use:
error_reporting(E_ALL); ... But in this case the php webpage does not even load at all so I can't see any of the debugging output.
When the php webpage is told to start the shellscript, it does actually run the shellscript fine. Because the 'soldatguardian' the shellscript runs, does start correctly.
I am kind of thinking it is because PHP keeps a handle on the program it starts and won't let go or something..
Here is the shellscript just in case:
Code:
#!/bin/sh
curdir="/home/s4r/servers/s4r2"
echo "Checking Server Environment..."
process=`ps uxw | grep $curdir/soldatserver | grep -v grep | awk '{print $11}'`
if [ -z "$process" ]; then
echo "Server is not active."
echo "Initializing Server Process..."
$curdir/soldatguardian
sleep 1
echo "Server Started Successfully"
else
echo "ERROR: Server Already Active"
fi
exit 1
It simply checks to see if the soldatserver is running, and if it isnt then it spawns it by running soldatguardian (which is a crash-prevention addon that handles launching the soldatserver instead). All of these run fine from commandline.
start.sh - runs fine from commandline, finishes in 2 seconds gives commandline back
soldatserver - runs fine from commandline, but uses commandline for all its server output
soldatguardian - runs fine from commandline, spawns soldatserver but moves it's output to a log file. gives commandline back
This code works fine to have PHP stop the server and load the page:
$last_line = exec($target."/soldatguardian stop &");
I am stumped..It is strange that stopping it doesnt cause hang but starting it does :\
Thank you for your help I am grateful
-Ji