root@PlayVirtualReality:~# cd samp
root@PlayVirtualReality:~/samp# cd samp03
root@PlayVirtualReality:~/samp/samp03# nohup ./restart.sh &
[1] 27278
root@PlayVirtualReality:~/samp/samp03# nohup: ignoring input and appending output to `nohup.out'
nohup: failed to run command `./restart.sh': Permission denied
#!/bin/sh
log=samp.log
dat=`date`
samp="/root/samp/samp03/samp03svr"
cd /root/samp/samp03
echo "${dat} watchdog script starting." >>${log}
while true; do
echo "${dat} Server exited, restarting..." >>${log}
mv /root/samp/samp03/server_log.txt /root/samp/samp03/scriptfiles/Logs/server_log.`date '+%m%d%y%H%M%S'`
${samp} >> $log
sleep 2
done
#!/bin/sh
msampdir="/home/samp"
mprocess=`ps -C samp03svr | grep -v PID`
if [ ! "$mprocess" ]; then
echo "=- SA-MP server is not running. Restarting... -="
cd "$msampdir"
nohup ./samp03svr &
fi
#!/bin/sh
logfile="/home/samp/server_log.txt"
timestamp=$(date --utc +%s)
thedate=$(date +"%B %d, %Y - %l:%M:%S")
logdir="/home/samp/server_logs"
if [ ! -d "$logdir" ]
then
mkdir "$logdir"
fi
cat "$logfile" > "$logdir"/Logs_Server_$timestamp.txt
echo "SAMP Logs refreshed at: $thedate" > "$logfile"
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
*/1 * * * * samp /home/samp/autorestart.sh
0 */12 * * * samp /home/samp/logrestarter.sh
this is my difficulty in editing the file crondtab could help me.
|