Linux Server restarter
#1

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??
Reply
#2

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

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
Reply
#4

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.
Reply
#5

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
Reply
#6

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?
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)