Hopefully someone can help me out with this: I am running a game server that crashes with a segfault every 3 hours, I am trying to get a restart script working but I'm a complete noob when it comes to Linux(Debian) Working directory is: /home/(username)/workspace/MMOCoreORB/bin To start Program: ./core3 It starts in terminal and runs until the 3 hour crash... At the moment I've installed monit but I have no clue what to do next.... I copied the Apache2 restart section in the monit config and made changes to run the program I need but not sure I did it right either...
server.sh:
#!/bin/bash
case $1 in
start)
echo $$ > server.pid;
cd /home/user/workspace/MMOCoreORB/bin/
exec ./core3
;;
stop)
kill $(cat server.pid);
rm server.pid
;;
*)
echo "usage: server {start|stop}" ;;
esac
exit 0
monit config:
GNU nano 2.2.4 File: /etc/monit/monitrc
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file and a complete list of statements and
## options, please have a look in the Monit manual.
##
##
###############################################################################
## Global section
###############################################################################
##
## Start Monit in the background (run as a daemon):
#
set daemon 120 # check services at 2-minute intervals