Hello all,

I have written check command like

check process sample-test with pidfile /tmp/sample-test.pid
    start = "/bin/sh -c 'cd /tmp ; nohup sleep 1000 1>/tmp/sample-test.log
2>/tmp/sample-test.log & echo $! > /tmp/sample-test.pid'" with timeout 10
seconds
    stop  = "/bin/sh -c 'kill -9 `cat /tmp/sample-test.pid`'"
    if does not exist then alert
    if does not exist then restart
    if 2 restarts within 5 cycles then alert

# cat /tmp/sample-test.pid
#11445

#ps -aux | grep sleep

root     11446  0.0  0.0 107896   608 ?        S    15:04   0:00 sleep 1000
root     11445  0.0  0.0 113120   652 ?        S    15:04   0:00 /bin/sh -c
cd /tmp && nohup sleep 1000 1>/tmp/sample-test.log 2>/tmp/sample-test.log &
echo $! > /tmp/sample-test.pid




*Question 1: Why "/bin/sh -c cd /tmp..." PID is getting loged in pid file,
instead of "sleep 1000" pid.*
*What am i doing wrong?*

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

Reply via email to