我尝试将 和其他一些服务配置为看门狗supervisord
。目标是在服务崩溃或停止时自动重新启动。tomcat
redis
这是我的 redis 和 tomat 配置
[program:redis]
command=sudo /etc/init.d/redis-server start
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisour_redis.err.log
stdout_logfile=/var/log/supervisour_redis.out.log
logfile_maxbytes=10MB
[program:tomcat]
command=sudo /root/apache-tomcat-7.0.75/bin/startup.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisour_tomcat.err.log
stdout_logfile=/var/log/supervisour_tomcat.out.log
logfile_maxbytes=10MB
但我无法完全控制服务。重新启动后supervisor
,我看到
root@test:~/apache-tomcat-7.0.75/bin# supervisorctl
redis BACKOFF Exited too quickly (process log may have details)
tomcat BACKOFF Exited too quickly (process log may have details)
如果我tomcat
从主管开始,它会显示错误
supervisor> start tomcat
tomcat: ERROR (abnormal termination)
但是tomcat正在启动(我已经用了ps aux | grep tomcat
)。但我无法阻止雄猫。万一redis
主管说服务停止了,但事实并非如此!