05.04.2014, 15:34
Method 2
If you don't want to use crontab and if you want to have server log saved to a separate directory on server crash you can use this script.
To keep your server online using this script, first you need to stop your server and then execute it with this command:
nohup ./restart.sh &
restart.sh:
This method will bring your server back up whenever it crashes or when the RCON exit command is issued. It will also save the server log into a separate directory.
Where to put restart.sh ? in samp folder? or where? and i got samp in cd/root/samp03/ , can someone edit this for me please?
If you don't want to use crontab and if you want to have server log saved to a separate directory on server crash you can use this script.
To keep your server online using this script, first you need to stop your server and then execute it with this command:
nohup ./restart.sh &
restart.sh:
Код:
#!/bin/sh
log=samp.log
dat=`date`
samp="/path/to/samp/server/samp03svr"
cd /path/to/samp/server
echo "${dat} watchdog script starting." >>${log}
while true; do
echo "${dat} Server exited, restarting..." >>${log}
mv /path/to/samp/server/server_log.txt /path/to/samp/server/logs/server_log.`date '+%m%d%y%H%M%S'`
${samp} >> $log
sleep 2
done
Where to put restart.sh ? in samp folder? or where? and i got samp in cd/root/samp03/ , can someone edit this for me please?



?? on centos 6 64 bit ?