当我尝试运行进入无限循环的脚本时,5.8.1之后的Monit开始记录超时错误。但过了一会儿它突然注意到脚本真的运行了。如何避免这个令人讨厌的错误?
**#!/usr/bin/perl
while(1)
{.
print "!\n";
sleep 1;
}**
check process move-data matching "move-data.pl"
start program = "/home/volcanodev/move-data"
stop program = "/usr/bin/pkill -f move-data.pl"
#!/bin/bash
cd /var/opt/poller
# Just run a script with an infinite loop. The script does not stop
/usr/bin/perl move-data.pl --config=sha
Jun 10 12:29:04 billing monit[386]: 'move-data' trying to restart
Jun 10 12:29:04 billing monit[386]: 'move-data' stop: /usr/bin/pkill
Jun 10 12:29:04 billing monit[386]: 'move-data' start: /bin/sh
Jun 10 12:29:34 billing monit[386]: 'move-data' failed to start (exit status -1) -- Program /bin/sh timed out
Jun 10 12:29:34 billing monit[386]: 'move-data' restart action done
Jun 10 12:30:04 billing monit[386]: 'move-data' process is running after previous exec error (slow starting or manually recovered?)
如果我尝试在没有bash文件的情况下启动程序
,则相同start program = "/usr/bin/perl move-data.pl --config=sha"
如果我尝试使用pid文件而不是进程名称匹配来启动相同的程序(当然,更改脚本以创建pid文件)
check process move-data with pidfile /tmp/move-data.pid