SA-MP Forums Archive
Maintaining the online server. Help! - 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: Maintaining the online server. Help! (/showthread.php?tid=57024)



Maintaining the online server. Help! - LeePL - 03.12.2008

Hello members,
My problem concerns about whether there is any restarter server to samp, for Linux?
Is there such a thing? Please send me a quick answer, if possible...

Sorry about my English, but I'm Polish and do not know too much about it...




Re: Maintaining the online server. Help! - dextervip - 03.12.2008

All you need to use the program below is a Linux environment, and the possibility to use cron. This program will check if the samp02svr process is running, and if it isn't, start it up again. You'll need to install the following crontab:
Код:
*/5 * * * * /path/to/samp/checksamp.sh
checksamp.sh:
Код:
#!/bin/sh
 
PROCESS_COUNT=$(ps -fu root | grep samp02svr | grep -v grep | wc -l)
case $PROCESS_COUNT in
0) /path/to/samp02svr &
;;
1) #OK, program is already running once
;;
*) #OK, program is already multiple times
;;
esac
Make sure that you have to correct paths set up, the script won't work if you haven't. The script is currently unable to handle multiple SA-MP Servers on the same machine, but works perfectly when there is only one running/needed. You need to chmod the checksamp.sh file to 0755 (+x)!


Re: Maintaining the online server. Help! - LeePL - 03.12.2008

Thank you for your help and for that I somehow understand. Cheers


Re: Maintaining the online server. Help! - caribe88 - 04.12.2008

I have 3 server on linux and sometimes they have error on reading the game mode, filterscprts or so bud more as nohup ./samp02Xsvr i dont use and they work perfect