monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong PID


From: Bhuvan Gupta
Subject: Wrong PID
Date: Sat, 26 Aug 2017 15:14:00 +0530

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]