00000 Posted May 7, 2013 Posted May 7, 2013 Hi, I've looked around and asked various people but I still clan't find a good way to make an auto-restart script for my server (Running ubuntu 12.04) Does anyone know how to make one >_<? Thanks.
Kannos'v Lightdust Posted May 8, 2013 Posted May 8, 2013 found on ja+ mod files. japlus_linux_autorestart.sh #!/bin/bash# *********JA+ Linux server AutoRestart script*******************************# this is a secure startup file that uses the raven dedicated server pack for linux# if the server crashes, it will be immediatly restarted within 10s and the restart time will be writen to the file# japlus_restart.txt# ## 1) install the raven dedicated server pack for linux (and the JAPLUS mod)# 2) and then put this file in your gamedata folder# 3) then execute this file to start your server with JA+ mod (don't forget the chmod +x)## ****************************************/bin/ps ux > ./.tempalive=`grep -l 'linuxjampded' ./.temp | wc -l`; if [ $alive -eq 0 ]then lastrestart=`/bin/date`; echo "JA+ server restarted on $lastrestart" > ./japlus_restart.txt ; nohup ./linuxjampded +set dedicated 2 +set fs_game japlus +exec server.cfg >log.txt 2>&1 sleep 10; nohup ./start_japlus_linux_autoRestart.sh & fi
Raz0r Posted May 9, 2013 Posted May 9, 2013 ...Because writing the entire process list to a file and grepping it every 10 seconds won't cause any issues If you have the option to run it in a screen session, I would recommend something like:#!/bin/bash echo "Superleet startup script!" status=1 while [ $status -ne 0 ] do ./linuxjampded +set dedicated "2" +set fs_game "japlus" +exec "server.cfg" >log.txt 2>&1 status=$? if [ $status -ne 0 ] then date=`/bin/date` echo "Server crashed with status "$status" at "$date fi done echo "Server exited peacefully"
00000 Posted May 9, 2013 Author Posted May 9, 2013 When I execute it,./restart.sh: line 3: runline: command not found./restart.sh: line 5: syntax error near unexpected token `do'./restart.sh: line 5: `while do'
00000 Posted May 9, 2013 Author Posted May 9, 2013 ...Because writing the entire process list to a file and grepping it every 10 seconds won't cause any issues If you have the option to run it in a screen session, I would recommend something like: #!/bin/bash echo "Superleet startup script!" status=1 while [ $status -ne 0 ] do ./linuxjampded +set dedicated "2" +set fs_game "japlus" +exec "server.cfg" >log.txt 2>&1 status=$? if [ $status -ne 0 ] then date=`/bin/date` echo "Server crashed with status "$status" at "$date fi done echo "Server exited peacefully"This worked ^^ ty!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now