我在使用Supervisor循环运行PHP脚本时遇到问题。我有PHP脚本,可以从命令行调用php myscript.php
和相应的supervisord.conf
,即:
[program:queuereceiver]
command=/var/www/app/myscript.php
directory=/var/www/app
autostart=true
autorestart=true
startsecs=0
startretries=3
user=www-data
stdout_logfile=/var/www/app/logs/queue_out.log
stdout_logfile_maxbytes=1MB
stderr_logfile=/var/www/app/logs/queue_err.log
stderr_logfile_maxbytes=1MB
这只是将脚本作为进程运行,当它完成时(大多数不到1秒)再次循环运行它。
事情是queuereceiver
不时停止运行而没有任何错误被放到queue_err.log
。
如果你有类似的情况 - 任何想法为什么会发生,甚至如何调试它?您可能会注意到此PHP脚本从队列接收消息。