Permissions Denied for AutoBoot Method 2
#1

Hey Everyone.
I am trying to get my server to auto boot using Method 2 from the sa-mp wiki (Click here) But i am unsure if the paths specified in the restart.sh is from root or the username that sa-mp server is installed onto.

Код:
Method 2

If you don't want to use crontab and if you want to have server log saved to a separate directory on server crash you can use this script.

To keep your server online using this script, first you need to stop your server and then execute it with this command:

nohup ./restart.sh &

restart.sh:

Код:
#!/bin/sh
log=samp.log
dat=`date`
samp="/path/to/samp/server/samp03svr"
cd /path/to/samp/server
 
echo "${dat} watchdog script starting." >>${log}
while true; do
        echo "${dat} Server exited, restarting..." >>${log}
        mv /path/to/samp/server/server_log.txt /path/to/samp/server/logs/server_log.`date '+%m%d%y%H%M%S'`
        ${samp} >> $log
	sleep 2
done
This method will bring your server back up whenever it crashes or when the RCON exit command is issued. It will also save the server log into a separate directory.
Example
Would it be
samp="/home/username/samp03/samp03svr" (root)
or
samp="/samp03/samp03svr" (Username)

Same For
cd /path/to/samp/server

I am doing this logged in from the user account and not root
I am placing the restart.sh into /samp03/ folder
I am running CentOS 5.5

----Edit----
And Since
nohup ./restart.sh &
was giving me the same errors as 'Geso' was getting. (Here)
Код:
[1] 1771
[root@vps***** samp03]# nohup: appending output to `nohup.out'
nohup: cannot run command `./restart.sh': Permission denied
So i am using the command 'chmod +x restart.sh' in replacement of nohup ./restart.sh &

Cheers for any assistance
Reply
#2

you can do chmod 777 /Directory/restart.sh to make nohup ./restart.sh to work.

edit: Make sure the restart.sh has 777 chmod settings
Reply
#3

chmod it 777 and sudo it, maybe?
Reply
#4

Yea, but that's not the problem i don't think...
The problem is the location at which it is reading the files from
Is it reading from where root reads them from or where the samp server's account reads from?
Reply
#5

root reads from, You should put restart.sh inside the SA-MP Directory
Reply
#6

Quote:
Originally Posted by Deal-or-die
Посмотреть сообщение
I am placing the restart.sh into /samp03/ folder
Soooo if i placed 'restart.sh' in the samp directory (Where is was)

that from the root directory would be
/home/username/samp03/restart.sh

and from username directory it would be
/samp03/restart.sh
Reply
#7

Thats a new one... after doing
Код:
chmod 777 /home/username/samp03/restart.sh
I now get this error
Код:
[username@server samp03]$ nohup ./restart.sh
nohup: appending output to `nohup.out'
nohup: cannot run command `./restart.sh': No such file or directory
Reply
#8

Yeah, basically yes, If you do go to samp03 then just do chmod 777 ./restart.sh and then nohup ./restart.sh &

I did it on my VPS and it worked like a charm

edit: You have to be in samp03 to do nohup ./restart.sh &
Reply
#9

Hmm.... Did i not do that?
This Image Clearly states that i am in the directory WITH the restart.sh file


Or use this link
Reply
#10

Still Not fixed... Any Other methods of Starting a CentOS based server without using method 1 or 3?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)