[UBUNTU] Re-starting server when crashed
#1

Hi there.

Unfortunately, when my server crashes it doesnt re-start automatically. Iґm not a real Linux pro so Iґm gonna ask here, maybe someone got a solution.

Iґm using Ubuntu with Screen.
Reply
#2

Код:
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
This works best by far for me( instant restart )
Reply
#3

or for what he actually wants
I think its:
Код:
./samp03srv & nohup
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)