- edited description
Monit not invoking start or stop actions; even though after passing PATH variable to the script.
Following is the script i am using to restart the apache instance; monit is running as root user
But i am able to execute same script from terminal. Monit version 5.30.0
There is a shebang line in the “apachectl“ script as “#!/bin/sh“
check process bamboo-nosm matching /local/mnt/apache/bamboo-nosm
start program="/bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl start >> /temp/file2'"
stop program="/bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl stop >> /temp/file2'"
if does not exist then restart
when i executed following command “monit -vv reload” got verbose as follows; even though scripts exists in the path; like program doesn’t exist.
/etc/monit/apacheinstancescontrolfile.conf:3: Program does not exist: 'program='
/etc/monit/apacheinstancescontrolfile.conf:4: Program does not exist: 'program='
for testing i stopped the apache instance but monit is not invoking actions;
in the log i am getting as follows
[2022-03-31T04:59:22-0700] error : 'bamboo-nosm' process is not running
[2022-03-31T04:59:22-0700] info : 'bamboo-nosm' trying to restart
[2022-03-31T04:59:22-0700] info : 'bamboo-nosm' start: 'program= /bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl start >> /temp/file2'
[2022-03-31T04:59:22-0700] error : 'bamboo-nosm' failed to start (exit status -1) -- Program program= failed: File 'program=' does not exist
[2022-03-31T04:59:52-0700] error : 'bamboo-nosm' process is not running
[2022-03-31T04:59:52-0700] info : 'bamboo-nosm' trying to restart
[2022-03-31T04:59:52-0700] info : 'bamboo-nosm' start: 'program= /bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl start >> /temp/file2'
[2022-03-31T04:59:52-0700] error : 'bamboo-nosm' failed to start (exit status -1) -- Program program= failed: File 'program=' does not exist
[2022-03-31T05:00:23-0700] error : 'bamboo-nosm' process is not running
[2022-03-31T05:00:23-0700] info : 'bamboo-nosm' trying to restart
[2022-03-31T05:00:23-0700] info : 'bamboo-nosm' start: 'program= /bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl start >> /temp/file2'
[2022-03-31T05:00:23-0700] error : 'bamboo-nosm' failed to start (exit status -1) -- Program program= failed: File 'program=' does not exist
Comments (7)
-
reporter -
reporter - changed title to Monit not invoking start or stop actions; even though after passing PATH variable to the script.
- edited description
-
reporter - edited description
-
If I see this correctly, it's a syntax-error in your config. But to be honest, I think, it's more a syntax error in the monit syntax parser.
As the error states, it tries to run a program calles
programm=
...
The root error might be here: https://bitbucket.org/tildeslash/monit/src/e985b8ec67d2ee0d724d86a75517d2387a435fb6/src/l.l#lines-138
startarg start{ws}?(program)?{ws}?([=]{ws})?["] ^ IF there IS an equal-sign (=) there MUST be a space after it.
You might want to try
start program = "/bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl start >> /temp/file2'" stop program = "/bin/sh -c 'PATH=/bin:/usr/bin:/root/bin /local/mnt/apache/bamboo-nosm/bin/apachectl stop >> /temp/file2'"
-
repo owner I confirm Henning’s s analysis, will fix. The workaround with adding spaces around the '=' character works fine
-
repo owner - changed status to resolved
Fixed: Issue
#1035: If the start/stop/restart program statement contains the equal sign, which is not followed by a space character, the configuration is not parsed correctly.→ <<cset 715a2d128f9d>>
-
repo owner - marked as trivial
- Log in to comment