[Top][All Lists]

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

Re: Check the age of a process

From: Lutz Mader
Subject: Re: Check the age of a process
Date: Thu, 22 Aug 2019 22:35:47 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hello David,
nice idea, have a look to

Try to combine "exits" and "uptime" to stop a running process.

check process sleep matching "sleep"
  start program "/bin/ksh -c '/bin/echo start; /bin/sleep 300 &'"
  stop program "/bin/ksh -c 'kill -9 `ps -fu $USER | awk "/[Ss]leep/ {
print \\\\$2 }"`'"
  if uptime > 3 minutes then alert
  if uptime > 5 minutes then exec "/bin/ksh -c 'kill -9 `ps -fu $USER |
awk "/[Ss]leep/ { print \\\\$2 }"`'"
  if exist for 10 cycles then exec "/bin/ksh -c 'kill -9 `ps -fu $USER |
awk "/[Ss]leep/ { print \\\\$2 }"`'"

As long as the process is available the status is "Exists" and if the
process is not available the status is "OK".

Unfortunately you can not use "stop" to stop the process because this
will set the monitor status to "unmonitor", this will stop monitoring
the process in general.

Monit check all processes called "sleep" and send an alert after 3
minutes and stop the process after 5 minutes. The exists test stop the
process also.

A sample only,

reply via email to

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