Re: Wrong PID

Bhuvan Gupta <[email protected]>
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <CAF4ab9UHUMCjJ6KV0AdHjXiqn8=D1Jbrpu-0EfJcjpaL33pDZw@mail.gmail.com>
Using monit 5.23.0 on centos 7

On Sat, Aug 26, 2017 at 3:14 PM, Bhuvan Gupta <[email protected]> wrote:

> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.