我有两个PHP脚本作为RabbitMQ消费者,我希望他们通过监控启动和监控(+自动重新启动)。
我的/ etc / monitrc这两个进程如下所示:
check process php-magento-category matching "openerp:category:consumer" start program = "/usr/bin/php /home/dev/magento/base/magento2/bin/magento openerp:category:consumer" as uid cehrig and gid cehrig check process php-magento-product matching "openerp:product:consumer" start program = "/usr/bin/php /home/dev/magento/base/magento2/bin/magento openerp:product:consumer" as uid cehrig and gid cehrig
实际上,monit只能启动这两个进程中的第一个,使ps传真看起来像这样:
4622 ? Sl 0:00 monit 5036 ? Ss 0:00 \_ /usr/bin/php /home/dev/magento/base/magento2/bin/magento openerp:category:consumer
第二个PHP过程从来没有产生。 Monit状态看起来像这样
Process 'php-magento-category' status Initializing monitoring status Initializing monitoring mode active on reboot start data collected Tue, 10 Jan 2017 10:50:58 Process 'php-magento-product' status Execution failed | Does not exist monitoring status Monitored monitoring mode active on reboot start data collected Tue, 10 Jan 2017 10:51:28
有人能指出我如何解决这个问题的正确方向吗? 提前致谢。
您可以创build一个运行所需PHP命令的shell脚本,然后您可以从Monit调用shell脚本。