用monit重新启动程序

希望有人能帮助我这个:我正在运行一个游戏服务器,每隔3小时崩溃与段错误,我想重启脚本工作,但我是一个完整的noob,当涉及到Linux(Debian)工作目录是: / home /(用户名)/工作区/ MMOCoreORB / bin要启动程序: ./core3它在terminal启动,运行,直到3小时的崩溃…目前,我已经安装了监视,但我不知道什么做下一步….我复制的Apache2重新启动部分在监视configuration,并作出改变,运行我需要的程序,但不知道我做对了吗…

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 

监控configuration:

  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