SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 11/09/2016, 07:10 PM   #1
majesticz03
Little Clucker
 
Join Date: Jun 2016
Posts: 17
Reputation: 0
Default Linux restart.sh HELP

I am trying to setup restart.sh

Code:
#!/bin/sh
log=samp.log
dat=`date`
samp="/home/mike/samp03/samp03svr"
cd /home/mike/samp03
 
echo "${dat} watchdog script starting." >>${log}
while true; do
        echo "${dat} Server exited, restarting..." >>${log}
        mv /home/mike/samp03/server_log.txt /home/mike/samp03/logs/server_log.`date '+%m%d%y%H%M%S'`
        ${samp} >> $log
	sleep 2
done
When i do nohup ./restart.sh &
i get this
nohup: failed to run command ‘./restart.sh’: No such file or directory

and only ./restart.sh &

-bash: ./restart.sh: /bin/sh^M: bad interpreter: No such file or directory
__________________
Owner of NEF - Next Evolution Freeroam
www.nefserver.com
majesticz03 is offline   Reply With Quote
Old 11/09/2016, 07:48 PM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,066
Reputation: 2660
Default Re: Linux restart.sh HELP

File must be executable. Have you used chmod +x after creating it? Also for the shebang (#! line) you should normally be able to use /bin/bash.
__________________
Vince is offline   Reply With Quote
Old 11/09/2016, 10:19 PM   #3
davidpolak59
Little Clucker
 
davidpolak59's Avatar
 
Join Date: Mar 2012
Posts: 22
Reputation: 4
Default Re: Linux restart.sh HELP

What distribution are you using
__________________
davidpolak59 is offline   Reply With Quote
Old 12/09/2016, 09:19 AM   #4
majesticz03
Little Clucker
 
Join Date: Jun 2016
Posts: 17
Reputation: 0
Default Re: Linux restart.sh HELP

I am using Centos 7
__________________
Owner of NEF - Next Evolution Freeroam
www.nefserver.com
majesticz03 is offline   Reply With Quote
Old 12/09/2016, 11:02 AM   #5
Sublime
High-roller
 
Sublime's Avatar
 
Join Date: Jul 2013
Location: 6ix god
Posts: 992
Reputation: 223
Default Re: Linux restart.sh HELP

Quote:
Originally Posted by Vince View Post
File must be executable. Have you used chmod +x after creating it? Also for the shebang (#! line) you should normally be able to use /bin/bash.
i don't think this has any relation to permissions

edit: script works well for me, show me your $PATH variable (echo $PATH), or probably your system is misreading the file. install dos2unix, use it on the script and see if it works
__________________
Quote:
Originally Posted by Zorono View Post
Becuase its the best mod of GTA SA
and itsn't dead, Kalcor is having some proplems on his real life so he is busy now and release the new version now so shut your fucking mouse !!!!!!!!
Sublime is offline   Reply With Quote
Old 12/09/2016, 11:20 AM   #6
majesticz03
Little Clucker
 
Join Date: Jun 2016
Posts: 17
Reputation: 0
Default Re: Linux restart.sh HELP

i did echo $path in samp03 folder i get this
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
__________________
Owner of NEF - Next Evolution Freeroam
www.nefserver.com
majesticz03 is offline   Reply With Quote
Old 12/09/2016, 12:51 PM   #7
Sublime
High-roller
 
Sublime's Avatar
 
Join Date: Jul 2013
Location: 6ix god
Posts: 992
Reputation: 223
Default Re: Linux restart.sh HELP

Quote:
Originally Posted by majesticz03 View Post
i did echo $path in samp03 folder i get this
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
yum install dos2unix

dos2unix yourscript.sh

and then try running the script
__________________
Quote:
Originally Posted by Zorono View Post
Becuase its the best mod of GTA SA
and itsn't dead, Kalcor is having some proplems on his real life so he is busy now and release the new version now so shut your fucking mouse !!!!!!!!
Sublime is offline   Reply With Quote
Old 12/09/2016, 03:35 PM   #8
majesticz03
Little Clucker
 
Join Date: Jun 2016
Posts: 17
Reputation: 0
Thumbs up Re: Linux restart.sh HELP

Quote:
Originally Posted by Sublime View Post
yum install dos2unix

dos2unix yourscript.sh

and then try running the script
Tnx this helped me thankyou very much
i realy needed this
__________________
Owner of NEF - Next Evolution Freeroam
www.nefserver.com
majesticz03 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
linux auto restart VIP475 Server Support 8 05/04/2014 05:22 PM
How restart linux server? PatrickNL Server Support 12 24/03/2013 03:28 PM
Linux Server Crash On Restart Sascha Help Archive 2 23/01/2011 06:28 PM
Auto Restart for Linux Red Hat / CentOS? Javi_Cogollero Server Support 1 31/03/2010 10:54 AM
Linux Server Restart Help Gappy Server Support 3 22/10/2009 07:54 AM


All times are GMT. The time now is 07:36 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.