希望有人能帮助我解决这个问题:我正在运行一个游戏服务器,它每 3 小时就会因段错误而崩溃一次,我正在尝试让重启脚本运行,但是我对 Linux(Debian)完全是个菜鸟。工作目录是: /home/(用户名)/workspace/MMOCoreORB/bin 启动程序: ./core3 它在终端启动并运行,直到 3 小时崩溃...目前我已经安装了 monit,但我不知道下一步该做什么......我复制了 monit 配置中的 Apache2 重启部分并进行了更改以运行我需要的程序但不确定我是否做对了...
服务器.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
监控配置:
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