<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
On Mon, 2014-01-06 at 22:45 -0500, Stéphane Graber wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Mon, Jan 06, 2014 at 09:32:33PM -0600, Ted Gould wrote:
<FONT COLOR="#737373">> It seems like most of the examples in the Cookbook recommend that if you</FONT>
<FONT COLOR="#737373">> want to stop a job in the pre-start stanza, you should call "stop" which</FONT>
<FONT COLOR="#737373">> will handle stopping the job for you.  But, it seems looking at the</FONT>
<FONT COLOR="#737373">> Upstart code I can just as easily return a negative return value to</FONT>
<FONT COLOR="#737373">> cause the job to stop:</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> <A HREF="http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/job.c#L417">http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/job.c#L417</A></FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> Is there a reason I should call "stop" over just returning a negative</FONT>
<FONT COLOR="#737373">> value? </FONT>

Calling { stop; exit 0; } also means the job won't be considered as failed.

Returning non-zero will log an error in the log file and prevent any job
depending on the current job from starting (which may or may not be what
you want).

So in short, exitting non-zero or calling stop+exit are two different
things with different behaviours, you have to choose which you want.
</PRE>
</BLOCKQUOTE>
<PRE>

</PRE>
Interesting, I didn't realize all of the implications there.  I thought that a stopped signal wasn't sent if a job was never started, and failing in pre-start would mean that it was never started.  So how would "failed" be tracked in this case?  There's no way to get an event "stopped foo RESULT=failed"?  It seems like jobs that have instances don't track failed in any visible way?  Also, will a failed pre-start trigger a respawn?<BR>
<BR>
Going down the rabbit hole,<BR>
Ted<BR>
<BR>
</BODY>
</HTML>