Run php script in monit

空扰寡人 提交于 2019-12-24 13:24:13

问题


Good day.

Is there any way to run a php "my_script.php" script as action in the fall a demon that keeps alive a node.js server?

The script to execute deletes records from a table of connected persons:

I tried different ways but it does not work me, currently the script that monitors the process is as follows:

#monit script 
set logfile /var/log/monit.log

check process nodejs with pidfile "/var/run/mi_server.pid"
start program = "/sbin/start mi_server"
stop program  = "/sbin/stop mi_server"
if failed port 8079 protocol HTTP
   then
   exec "/var/www/html/proyect/script_delete_pers.php"

Any idea how to properly execute the script?

regards


回答1:


Monit doesn't get all environment variables that an interactive shell does, so probably monit doesn't have the path to the PHP executable.

Try something like

exec "/usr/local/bin/php /var/www/html/proyect/script_delete_pers.php"


来源:https://stackoverflow.com/questions/21265226/run-php-script-in-monit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!