Change isTheServerRunning to be consistent with doStop

This commit is contained in:
Ben Peddell 2015-07-25 16:31:08 +10:00
parent 2110bc7fa6
commit 3759904f12

View File

@ -243,14 +243,22 @@ function getAvailableVersion(){
return $bnumber return $bnumber
} }
#
# Get the PID of the server process
#
function getServerPID(){
ps -ef | grep "$arkserverroot/$arkserverexec" | grep -v grep | awk '{print $2}'
}
# #
# Check id the server process is alive # Check id the server process is alive
# #
function isTheServerRunning(){ function isTheServerRunning(){
SERVICE="ShooterGameServer" if [ -n "`getServerPID`" ]; then
ps aux | grep -v grep | grep $SERVICE > /dev/null return 0
result=$? else
return $result return 1
fi
} }
# #
@ -327,7 +335,7 @@ doStop() {
tput sc tput sc
echo "Stopping server..." echo "Stopping server..."
# kill the server with the PID # kill the server with the PID
PID=`ps -ef | grep "$arkserverroot/$arkserverexec" | grep -v grep | awk '{print $2}'` PID=`getServerPID`
kill -INT $PID kill -INT $PID
tput rc; tput ed; tput rc; tput ed;