SA-MP Forums Archive
Linux Server restarter - 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: Linux Server restarter (/showthread.php?tid=328812)



Linux Server restarter - Unknownich - 26.03.2012

Hi ppl,
I bought a VPS few days ago, I installed all updates, ftp client and some other things. Server works fine but I forgot to make server restarter in case of crash. So I went to wiki and found this code:
Quote:

#!/bin/sh
log=samp.log
dat=`date`
samp="/home/User/samp03/samp03svr"
cd /home/User/samp03/

echo "${dat} watchdog script starting." >>${log}
while true; do
echo "${dat} Server exited, restarting..." >>${log}
mv /home/User/samp03/server_log.txt /home/User/samp03/logs/server_log.`date '+%m%d%y%H%M%S'`
${samp} >> $log
sleep 2
done

But when I try to start this using nohup ./restarter.sh & I got an error No such file or directory.
Path is ok, I tested it with cd -l /home/user/samp03/
Is this something with libraries or I made a mistake somewhere??


Re: Linux Server restarter - Riddy - 26.03.2012

Your sure it in the samp03 file? stop your server too..


Re: Linux Server restarter - Unknownich - 26.03.2012

Quote:
Originally Posted by Riddy
View Post
Your sure it in the samp03 file? stop your server too..
Yes Im sure, I stoped the server when I tried to do this.
Btw Im runing centOS


Re: Linux Server restarter - VOXrr - 26.03.2012

Did you use a UNIX file editor to create the bash script?
Use nano or vim, and just paste it all in, then save it.

Have you given the file the correct permissions to execute?
chomod +x restarter.sh

Have you checked for capitalisation errors?
'User' is not the same as 'user'


EDIT: OH! I remember modifying that restarter script. Remove the curly brackets '{ }' as well.


Re: Linux Server restarter - Unknownich - 26.03.2012

Quote:
Originally Posted by VOXrr
View Post
Did you use a UNIX file editor to create the bash script?
Use nano or vim, and just paste it all in, then save it.

Have you given the file the correct permissions to execute?
chomod +x restarter.sh

Have you checked for capitalisation errors?
'User' is not the same as 'user'


EDIT: OH! I remember modifying that restarter script. Remove the curly brackets '{ }' as well.
I gave right permissions and I saved in vim but nothing, I'l try you last suggestion


Re: Linux Server restarter - Unknownich - 26.03.2012

Quote:
Originally Posted by VOXrr
View Post
EDIT: OH! I remember modifying that restarter script. Remove the curly brackets '{ }' as well.
Nope, this is not solution. Any other suggestion or script?


Re: Linux Server restarter - Unknownich - 26.03.2012

Bump

Ok I got this code working now. I just renamed Restart.sh to restart.sh and I can execute normally now
But when I type /rcon exit server wont come back

EDIT: PROBLEM SOLVED, forgot to add few permissions :P