Hello,

I'm trying to follow the guide about how to detect a job respawning:
http://upstart.ubuntu.com/cookbook/#detect-if-a-job-stopped-before-reaching-its-respawn-limit

First step is this draft of a "watchdog" job:

$ cat /etc/init/alert-on-fail.conf
start on stopped PROCESS!=respawn
script
  echo "job '$JOB' just failed" >> /tmp/failures.log
  env >> /tmp/failures.log
end script

Then, I try to kill the target job using its PID, in the two following
scenarios:
  1. Target job doesn't contain "respawn"
  2. Target job does contain "respawn"

In scenario 1, I get content in /tmp/failures.log, which is expected:
job 'foo' just failed
UPSTART_INSTANCE=
INSTANCE=
UPSTART_JOB=alert-on-fail
TERM=linux
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
UPSTART_EVENTS=stopped
PWD=/
RESULT=ok
JOB=foo

In scenario 2 however, I don't get anything.

I'm noting that the $PROCESS environment variable is not set, and that $RESULT 
is "ok" although I'm expecting it to be "failed".

What am I missing? What is the proper way to detect that a process is being 
respawned?

Thanks.
-- 
David

-- 
upstart-devel mailing list
upstart-devel@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to