Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Run php script in monit

Run php script in monit

Problem

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

Problem courtesy of: Wilson Alvarez

Solution

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"
Solution courtesy of: Anders Bornholm

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Run php script in monit

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×