Jump to content

Linux Server Auto-restart.


noog

Recommended Posts

This is the script I use to start mta, save logfiles and automatically restart when

it dies (or is killed):

#!/bin/sh
log=watchdog.log
dat=`date`
mtavc="/home/mta/mtavc/MTAServer0.4.1"

echo "${dat} watchdog script starting." >>${log}
while true
do
 if [ `ps -ax | grep -c '/home/mta/mtavc/MTAServer0.4.1'` -eq 0 ]
 then
   echo "${dat} Server exited, restarting..." >>${log}
   datstr=`date "+%Y-%m-%d-%H%M%S"`
   mv mtaserver.log ${datstr}.log
   ${mtavc} >/dev/null 2>&1 &
 fi
 sleep 30  
done

Link to comment
  • 1 year later...
anyone know how i can get my (linux) mta server to automatically restart?

it's been dying on it's own every now and again and I could do with a way of keeping it up (excuse the pun) so i dont have to login and start it

Thanks :)

script is needed. if y didn't managed to do it, ask

--

[email protected]

Link to comment
  • 4 weeks later...
  • 7 months later...

Hey,

I know there is a couple downsides to "sleep", but it works fine for me. Using it with screen works perfectly, where you can just close the screen when your done with it. Take a look at "sleep" on good for more info :P

Cya,

Tommis

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...