I don't like to use a crond to keep my server up. so i found long time ago a pair of shell-scripts, that will keep your server up and running. You can use it not only with GTA but with some other servers also (i use it with UT2004 server also).
Script number 1, named startgtaserver.sh
Quote:
#!/bin/bash
cd /home/sampsvr
while [ true ]
do
cat /home/sampsvr/server_log.txt >> /home/sampsvr/gamelog.txt
./samp01b
done
|
This one goes near the server binary
Second script, named gtaserver:
Quote:
#!/bin/bash
server_start() {
/home/sampsvr/startgtaserver.sh & # put in full path and name of startup script
}
server_stop() {
killall startgtaserver.sh # your startup script name
killall samp01b # need to put in path to killall if its not in $PATH
}
server_restart() {
server_stop
sleep 1
server_start
}
case "$1" in
'start')
server_start
;;
'stop')
server_stop
;;
'restart')
server_restart
;;
*)
echo "usage $0 start|stop|restart"
esac
|
this one goes in /usr/local/bin
Just change paths in bouth scripts to yours, then you can start your server by typing
gtaserver start
stop server by typing
gtaserver stop
and finaly restart it by typing
gtaserver restart
the first script is responsible for keep your server up and running.
The second script is responsible for starting/stoping and restarting a server.
So, as you can see, no crond is involved.
And if you want your server to start automatically with your linux, put a line
gtaserver start
in your /etc/rc.d/rc.local , for example. (at least in System V -based os)
Hope it helps you
edited some typos and removed unnesessary coments from a script and named bouth scripts for better understanding.