/srv/irclogs.ubuntu.com/2012/08/14/#upstart.txt

neptharHey upstart community! I've got a question about non-zero exit codes in upstart. Typing out info now...17:51
neptharI have one upstart job which runs a web server, and another upstart job which I want to act as a crash reporter. The goal of the crash reporter is to examine the exit status of my web server and if it crashed or failed, shoot off an e-mail or something. I've managed to get the crash reporter job to run each time the web server is stopped, but the actual info that comes along with the 'stopping' even shows that the web server exited successfully, even whe17:53
neptharinduce a horrible crash.17:53
neptharI've just put up a sample of my config files in paste bin, along with snippets from the corresponding log files17:54
neptharhttp://pastebin.com/0ZbzNhzs17:54
neptharAm I somehow incorrectly handling the failure situation?17:55
neptharFor completeness, I've done more digging and discovered that setting the respawn flag causes non-zero exit status to NOT be reported in the 'stopping' event that is emitted. Question posed here: https://answers.launchpad.net/upstart/+question/20583619:01
SpamapSnepthar: interesting idea21:39
neptharoh hey, thanks. Not sure if you saw (my IRC client crashed), but I posted a question about it on launchpad21:39
neptharmy current workaround is to simply remove the respawn flag from my web service job21:40
neptharand the crash reporter now looks like this:21:40
neptharstart on stopped RESULT=failed JOB!=xxx-crash-reporter21:42
nepthartask21:42
neptharconsole log21:42
neptharscript21:42
neptharcase $JOB in21:42
neptharxxx-*)21:42
neptharsleep 221:42
neptharecho -n "Catching stopped job [$JOB] "21:42
nepthardate21:42
neptharlogfile="/var/log/upstart/${JOB}.log"21:42
nepthardesc_file="$(tempfile)"21:42
neptharecho "..." >> $desc_file21:42
nepthartail -n $LOG_LINES "$logfile" >> $desc_file21:42
neptharecho "Submitting notification..."21:42
neptharcurl --data-urlencode "application=${JOB}" \21:42
nepthar --data-urlencode "even=stopped" \21:42
nepthar --data-urlencode "description@$desc_file" "$NOTIFY_SERVER"21:42
neptharecho "Restarting job..."21:42
neptharinitctl start ${JOB} || true21:42
neptharecho "..done."21:42
nepthar;;21:42
nepthar*)21:42
nepthar;;21:42
neptharesac21:42
nepthar21:43
neptharend script21:43
neptharAh… REALLY sorry about that…21:43
SpamapSnepthar: apt-get install pastebinit :)21:45
neptharSpamapS: see http://pastebin.com/McTqEG2U21:45
neptharthanks :)21:45
SpamapSnepthar: realistically, your job can take over for respawn..21:46
SpamapSnepthar: not ideal, but its a workaround21:46
neptharSpampS: exactly. It takes over the respawn process, but I love the respawn limit features built in to upstart21:46
=== JanC_ is now known as JanC
JanCwhy not do the crash-reporting from the webserver job?22:11
SpamapSindeed, it will have more insight if the webserver is its own child and in its own process group22:27

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!