You need to specify full test/condition … for example if you want to execute 
the command if process doesn’t exist:

check process mongod with pidfile /data/db/mongodb.pd
    start program = “/etc/init.d/mongod start"
    stop program = “/etc/init.d/mongod stop"
    if does not exist then exec “ /bin/rm /var/lib/mongodb/mongod.lock”

Note that this will override the default restart action when the process 
doesn’t exist => you’ll need to add implicit restart command too, either:

check process mongod with pidfile /data/db/mongodb.pd
    start program = “/etc/init.d/mongod start"
    stop program = “/etc/init.d/mongod stop"
    if does not exist then exec “/bin/bash -c ‘/bin/rm 
/var/lib/mongodb/mongod.lock && /etc/init.d/mongod restart’”

or:

check process mongod with pidfile /data/db/mongodb.pd
    start program = “/etc/init.d/mongod start"
    stop program = “/etc/init.d/mongod stop"
    if does not exist then exec “ /bin/rm /var/lib/mongodb/mongod.lock”
    if does not exist then restart

Regards.
Martin


> On 29 Jul 2015, at 06:16, Rafael Torres <[email protected]> wrote:
> 
> Can someone help me with my syntax error. this is what the config looks like:
> 
> check process mongod with pidfile /data/db/mongodb.pd
>     start program = "/etc/init.d/mongod start"
>     stop program = "/etc/init.d/mongod stop "
> if failed then exec " /bin/rm  /var/lib/mongodb/mongod.lock"
> 
> but I keep getting syntax error then, what am I doing wrong?
> 
> Rafael L. Torres Jr. MSIA, CISSP, S +, N+
> 1509 Lowell Ct. 
> Crofton, MD 21114
> Cell: 757-876-1986
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to