UPSTART_EVENT and how to know why invoked
Alex Smith
alex at alex-smith.me.uk
Sat Jan 26 07:56:38 GMT 2008
On Jan 25, 2008 10:31 PM, <upstart at eehouse.org> wrote:
> Let's say I have a job that gets stopped in a couple of ways:
>
> stop on stopped foo
> stop on stopped bar
>
> I'd like to know which triggered me. The environment variable
> UPSTART_EVENT comes close, but only holds "stopped" (or in other
> cases, "runlevel") rather than "stopped foo" (or "runlevel 0"). Is
> this a bug or a feature? If the latter, what's the rationale? Would
> I be screwing myself if I modified the behavior? Would you take the
> patch?
This functionality is already there. The event (stopped) is stored in
UPSTART_EVENT, and then arguments to the event (foo or bar in the case
of your example), will be passed as arguments to the script, so you
can get to them like you would to get arguments with bash, e.g. if the
script was triggered by 'stopped foo', then $UPSTART_EVENT will be
stopped and $1 will be foo.
> BTW, sshd's been crashing pretty regularly on my up-to-date Gutsy
> system. If sshd were launched via an upstart jobfile and respawned I
> would never notice. That gonna happen someday? :-)
Yes, it should do ;) But maybe you should file a bug about it crashing.
More information about the upstart-devel
mailing list