SA-MP Forums Archive
Nee help with CentOS. - 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: Nee help with CentOS. (/showthread.php?tid=474301)



Nee help with CentOS. - RaiNyDayS - 07.11.2013

I want to install a script that auto restarts my server if it goes offline.

I tride using https://sampwiki.blast.hk/wiki/Linux_Server#Method_2

But Something seems to be going wrong. I keep getting this error when i use nohup ./restart.sh &
Quote:

nohup: ignoring input and appending output to `nohup.out'
nohup: failed to run command `./restart.sh': No such file or directory

My restart.sh is as follows:
Quote:

#!/bin/sh
log=samp.log
dat=`date`
samp="/root/samp03"
cd /root/samp03

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

My SAMP Directory on my VPS:



NOTES: I have the correct permissions set, the paths look alright, and yes i can start my server using ./samp03svr &

Any/all help would be GREATLY appreciated!


Re: Nee help with CentOS. - HyDrAtIc - 07.11.2013

It could be your gamemode/ or any other filterscript causing it, tried using on a different gamemode?


Re: Nee help with CentOS. - RaiNyDayS - 07.11.2013

no you dont understand what im having issues with, https://sampwiki.blast.hk/wiki/Linux_Server#Method_2 when i use method#2 i get the error:
Quote:

nohup: ignoring input and appending output to `nohup.out'
nohup: failed to run command `./restart.sh': No such file or directory

Nothing to do with GM or FS :P


Re: Nee help with CentOS. - BlueBaron - 07.11.2013

Umm... You need to be in the same directory where restart.sh is, or else you will get that warning.

PS: Try changing restart.sh to this:

Код:
#!/bin/sh
log=samp.log
dat=`date`
samp="/root/samp03/samp03svr"
cd /root/samp03

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



Re: Nee help with CentOS. - RaiNyDayS - 07.11.2013

I changed the code and im still getting same error. I am in the correct dirrectory:



Re: Nee help with CentOS. - Mark™ - 07.11.2013

Post your nohup.out log here.


Re: Nee help with CentOS. - linuxthefish - 07.11.2013

Type "./restart.sh" and paste what it says here. If it can't find that, type "ls" and "pwd", also pasting the output here.


Re: Nee help with CentOS. - FiReMaNStone - 07.11.2013

Try ./samp03svr &


Re: Nee help with CentOS. - PakistaniBaba - 07.11.2013

Mate ..
Its better to do this.

Chmod +x samp03svr announce
nohup ./samp03svr

I dont think that this is better to make ./restart.sh

Use this

Chmod +x samp03svr announce
nohup ./samp03svr


Re: Nee help with CentOS. - RaiNyDayS - 07.11.2013

Quote:
Originally Posted by linuxthefish
Посмотреть сообщение
Type "./restart.sh" and paste what it says here. If it can't find that, type "ls" and "pwd", also pasting the output here.
It says:

Quote:

[root@samp samp03]# ./restart.sh
-bash: ./restart.sh: /bin/sh^M: bad interpreter: No such file or directory

and ls