SA-MP Forums Archive
[UBUNTU] Re-starting server when crashed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: [UBUNTU] Re-starting server when crashed (/showthread.php?tid=113609)



[UBUNTU] Re-starting server when crashed - Striker_Moe - 14.12.2009

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.


Re: [UBUNTU] Re-starting server when crashed - hipy - 14.12.2009

Код:
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 )


Re: [UBUNTU] Re-starting server when crashed - darkrider366 - 14.12.2009

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