CRON Jobs + BASH scripts
#1

Good Morning.

I own a dedicated server, and my data centre are planning to upgrade their mains power AND UPS (Uninterruptible Power Supply) which will affect all servers on that supply. I happen to be one of them. Although the data centre are promising that servers will stay UP as much as possible, they also so that there is a chance of intermittent restarts / shutdowns of all servers. Now, I run TruckingWorld (my server) from that dedicated server (94.23.108.110) and so am looking for a way to keep it up as much as possible.

I have read the wiki, but anything i try seems not to work; I have a simple BASH script set up, which I run with nohup
Код:
nohup ./server.sh &
It runs, perfectly fine - but does not monitor server status nor does it start it back up if it is down (I have tested by turning off the server (rcon exit))

This is my BASH script:
Код:
#/bin/sh
log=samp.log
dat=`date`
samp="/home/truckingworld/server/samp03svr"
cd /home/truckingworld/server
 
echo "${dat} watchdog script starting." >>${log}
while true; do
        echo "${dat} Server exited, restarting..." >>${log}
        mv /home/truckingworld/server/server_log.txt /home/truckingworld/server/logs/server_log.`date '+%m%d%y%H%M%S'`
	./samp03svr &
	sleep 2
done
I quite literally have no idea what i'm doing with linux most of the time, I just know how to start / stop servers and monitor Lighttpd/Apache and MySQL

Can anyone see an error, or a reason as to why it isn't working? - Oh, and yes all my paths are correct, i can cd to them and do what the script tries to do manually (but that defeats the object)

Thanks,
Ash
Reply
#2

Can I bump this?

The server just crashed, again; although since i've merged my scripts (FS's) into my gamemode, the crashes don't happen as often.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)