Reputation: 635
Attempting to run a PHP script via shell script and keep getting a 'syntax error' from Monit when reading the shell script.
launchQueue.sh
#!/bin/sh
php /var/app/current/hello.php
The shell script will run on it's own and I've opened up all permissions. Monit is calling it from it's own directory /etc/monit.d/* - which is supposed to run all files within it when monit starts up.
Exact error reads: "/etc/monit.d/launchQueue.sh:2: Error: syntax error 'php'"
Running Monit Versions 5.2.5
Upvotes: 0
Views: 329
Reputation: 635
I figured out what the issue was and it was largely due to my own ignorance of using the terminal (I'm pretty new). I installed SupervisorD and ran into similar issues. It turned out that my root $PATH didn't include the normal user (?) $PATH. Once I exported the PATH over to root, it ran just fine.
Upvotes: 0
Reputation: 1965
Monit is having it own PATH and it is very small PATH. You should provide the full path to you php executable or re-defined the PATH in your script.
Try with (tune according to your location)
#!/bin/sh
/usr/bin/php /var/app/current/hello.php
Upvotes: 1