刚装好的redmine会时不时crash,所以写了一个脚本去监控之,如果检查结果不是三行,那么说明进程crash,那就启动它。
#!/usr/bin/newlisp
(set 'r (exec "ps -def | grep 'dispatch'"))
(set 'l (length r))
(if (= 3 l)
(begin
(append-file "/opt/ok.log" (append (string (now 480)) ": redmine works fine\n"))
(exit)))
(append-file "/opt/error.log" (append (string (now 480)) ": redmine is dead, restart it now\n"))
(exec "service redmine start")
(exit)
这段代码要放在crontab中运行。
crontab就不说了。之前的博客中有。