<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Upstart 0.5: Events</title>
	<atom:link href="http://www.netsplit.com/2008/04/27/upstart-05-events/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.netsplit.com/2008/04/27/upstart-05-events/</link>
	<description></description>
	<lastBuildDate>Sat, 06 Mar 2010 04:51:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Cacadril</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1855</link>
		<dc:creator>Cacadril</dc:creator>
		<pubDate>Sat, 13 Feb 2010 00:18:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1855</guid>
		<description>Frymaster, I have Fedora 12 with upstart version 3.11 (and a bunch of fedora-specific patches). I had a look at the code and understood that actually, the present documentation says it almost all.  Disclaimer: I only had a quick look at a few files, and may well have misunderstood things.

The upstart program (&quot;init&quot;) emits a short list of events:
  startup
  stalled
  control-alt-delete (formerly ctrlaltdelete or something similar)
  kbdrequest
  starting
  started
  stopping
  stopped
(The last four relate to jobs. The first, startup, relates to init itself.)

The telinit program emits events named &quot;runlevel&quot;. (Formerly runlevel-/n/.)

The initctl program emits events with arbitrary names specified on the command line.  This can be used in various scripts under /etc, e.g. on my Fedora12,
/etc/gdm/Init/Default:initctl -q emit login-session-start DISPLAY_MANAGER=gdm.

Events don&#039;t just have names, they have also arguments - a list of arbitrary strings, and &quot;environment variables&quot;.  Job files specify &quot;start on xxx&quot; and &quot;stop on xxx&quot;, where xxx are specifications that can match a number of events.  I suppose that when an event happens init checks all such start/stop on specifications to see if they should be triggered. The name must match exactly, the following words are &quot;file globs&quot; that are matched against successive arguments of the event. Events with too few args do not match.

There is just one thing I have found in the code that I had not become aware of reading the docs: If an event emission is considered &quot;failed&quot; (I am unsure what exactly the criteria are) a new event is automatically emitted with &quot;/failed&quot; appended to the name, and with the same arguments and environment. (If the &quot;name/failed&quot; event fails no new event is emitted.)

I suggest something is added to the documentation in the spirit of this reply, to give the reader a feeling of having a handle on the set of possible events and where to look for user-defined events.</description>
		<content:encoded><![CDATA[<p>Frymaster, I have Fedora 12 with upstart version 3.11 (and a bunch of fedora-specific patches). I had a look at the code and understood that actually, the present documentation says it almost all.  Disclaimer: I only had a quick look at a few files, and may well have misunderstood things.</p>
<p>The upstart program (&#8221;init&#8221;) emits a short list of events:<br />
  startup<br />
  stalled<br />
  control-alt-delete (formerly ctrlaltdelete or something similar)<br />
  kbdrequest<br />
  starting<br />
  started<br />
  stopping<br />
  stopped<br />
(The last four relate to jobs. The first, startup, relates to init itself.)</p>
<p>The telinit program emits events named &#8220;runlevel&#8221;. (Formerly runlevel-/n/.)</p>
<p>The initctl program emits events with arbitrary names specified on the command line.  This can be used in various scripts under /etc, e.g. on my Fedora12,<br />
/etc/gdm/Init/Default:initctl -q emit login-session-start DISPLAY_MANAGER=gdm.</p>
<p>Events don&#8217;t just have names, they have also arguments &#8211; a list of arbitrary strings, and &#8220;environment variables&#8221;.  Job files specify &#8220;start on xxx&#8221; and &#8220;stop on xxx&#8221;, where xxx are specifications that can match a number of events.  I suppose that when an event happens init checks all such start/stop on specifications to see if they should be triggered. The name must match exactly, the following words are &#8220;file globs&#8221; that are matched against successive arguments of the event. Events with too few args do not match.</p>
<p>There is just one thing I have found in the code that I had not become aware of reading the docs: If an event emission is considered &#8220;failed&#8221; (I am unsure what exactly the criteria are) a new event is automatically emitted with &#8220;/failed&#8221; appended to the name, and with the same arguments and environment. (If the &#8220;name/failed&#8221; event fails no new event is emitted.)</p>
<p>I suggest something is added to the documentation in the spirit of this reply, to give the reader a feeling of having a handle on the set of possible events and where to look for user-defined events.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frymaster</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1851</link>
		<dc:creator>frymaster</dc:creator>
		<pubDate>Tue, 09 Feb 2010 15:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1851</guid>
		<description>@Brian Fahrlander:

I had to implement something similar (I wanted a web interfact to start/stop certain jobs - namely, multiplayer game servers)

I wrote a helper script that would accept 2 parameters (jobname, and &quot;start&quot; or &quot;stop&quot;) and, if the jobname matches a list, would run the specified command.  You can&#039;t make scripts setuid, so instead I added the following line to /etc/sudoers:

%www-data ALL=NOPASSWD: /path/to/script

that lets anyone in the www-data group run my script as root using sudo, without a password (I needed that because it was being ran by web scripts; you probably don&#039;t)

I&#039;d imagine this is less than idea for your purposes (I assume you want users to be able to add their own jobs, and you also want the jobs to run as that user, rather than root)</description>
		<content:encoded><![CDATA[<p>@Brian Fahrlander:</p>
<p>I had to implement something similar (I wanted a web interfact to start/stop certain jobs &#8211; namely, multiplayer game servers)</p>
<p>I wrote a helper script that would accept 2 parameters (jobname, and &#8220;start&#8221; or &#8220;stop&#8221;) and, if the jobname matches a list, would run the specified command.  You can&#8217;t make scripts setuid, so instead I added the following line to /etc/sudoers:</p>
<p>%www-data ALL=NOPASSWD: /path/to/script</p>
<p>that lets anyone in the www-data group run my script as root using sudo, without a password (I needed that because it was being ran by web scripts; you probably don&#8217;t)</p>
<p>I&#8217;d imagine this is less than idea for your purposes (I assume you want users to be able to add their own jobs, and you also want the jobs to run as that user, rather than root)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Fahrlander</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1850</link>
		<dc:creator>Brian Fahrlander</dc:creator>
		<pubDate>Mon, 08 Feb 2010 02:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1850</guid>
		<description>I&#039;m wondering what the &quot;best practices&quot; approach is to running scripts _for_ other users? 

I went to a great deal of difficulty to get a device that doesn&#039;t require me to be root to init it...and I&#039;m seeing several different ways suggested to pull it off.

Is there a facility for a user&#039;s job (as opposed to a root job) to be called out there?</description>
		<content:encoded><![CDATA[<p>I&#8217;m wondering what the &#8220;best practices&#8221; approach is to running scripts _for_ other users? </p>
<p>I went to a great deal of difficulty to get a device that doesn&#8217;t require me to be root to init it&#8230;and I&#8217;m seeing several different ways suggested to pull it off.</p>
<p>Is there a facility for a user&#8217;s job (as opposed to a root job) to be called out there?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1413</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Mon, 06 Apr 2009 10:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1413</guid>
		<description>The current lack of documentation is not helped by an unfortunate confusion between events and jobs. When running &quot;ls /etc/event.d/&quot; one would expect to see a list of events, don&#039;t you think? Instead one sees the list of jobs.

In man events: &quot;upstart  works  on  the basis of event files that describe jobs that should be managed&quot;
How come a file holding the entire description of one and only one job is called an &quot;event&quot; file? Wouldn&#039;t be &quot;job file&quot; more intuitive?

I can imagine that changing a directory name would be too disruptive. But please at least fix the terminology in the documentation.</description>
		<content:encoded><![CDATA[<p>The current lack of documentation is not helped by an unfortunate confusion between events and jobs. When running &#8220;ls /etc/event.d/&#8221; one would expect to see a list of events, don&#8217;t you think? Instead one sees the list of jobs.</p>
<p>In man events: &#8220;upstart  works  on  the basis of event files that describe jobs that should be managed&#8221;<br />
How come a file holding the entire description of one and only one job is called an &#8220;event&#8221; file? Wouldn&#8217;t be &#8220;job file&#8221; more intuitive?</p>
<p>I can imagine that changing a directory name would be too disruptive. But please at least fix the terminology in the documentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SaintDanBert</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1161</link>
		<dc:creator>SaintDanBert</dc:creator>
		<pubDate>Tue, 03 Feb 2009 20:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1161</guid>
		<description>In this corner, we have everything that someone has programmed or configured our current box to respond to. This is represented by the config and script files under /etc and in some cases under /opt. [If elsewhere, please explain.]

In the other corner, we have &quot;events&quot; that are POSSIBLE because of (1)our hardware, (2) our behavior, (3) installed software packages, (4) our behavior, er -- use of installed software.

QUESTION: How do we learn -- other than source -- about the list of POSSIBLES? Are we forced to read source code for device drivers? Can &#039;strings&#039; or similar help us inspect binaries? If so, what are we looking for? 

RATIONALE: I have this workstation. It has all sorts of knobs and buttons. Some fire &quot;events&quot;. Others do not fire &quot;events&quot;. What causes/configures Fn+F7 to throw an &quot;event&quot; while &quot;Alt+F7&quot; does nothing?

Wanting to learn. Willing to write!! Needing information.
~~~ 0;-s</description>
		<content:encoded><![CDATA[<p>In this corner, we have everything that someone has programmed or configured our current box to respond to. This is represented by the config and script files under /etc and in some cases under /opt. [If elsewhere, please explain.]</p>
<p>In the other corner, we have &#8220;events&#8221; that are POSSIBLE because of (1)our hardware, (2) our behavior, (3) installed software packages, (4) our behavior, er &#8212; use of installed software.</p>
<p>QUESTION: How do we learn &#8212; other than source &#8212; about the list of POSSIBLES? Are we forced to read source code for device drivers? Can &#8217;strings&#8217; or similar help us inspect binaries? If so, what are we looking for? </p>
<p>RATIONALE: I have this workstation. It has all sorts of knobs and buttons. Some fire &#8220;events&#8221;. Others do not fire &#8220;events&#8221;. What causes/configures Fn+F7 to throw an &#8220;event&#8221; while &#8220;Alt+F7&#8243; does nothing?</p>
<p>Wanting to learn. Willing to write!! Needing information.<br />
~~~ 0;-s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Nekrasov</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1160</link>
		<dc:creator>Alexander Nekrasov</dc:creator>
		<pubDate>Mon, 02 Feb 2009 16:38:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1160</guid>
		<description>Hi Scott,

A question. Suppose I have a service that uses lots of wrappers to start. I use a &quot;script&quot; instead of an &quot;exec&quot; to start it, and from that script I call the topmost wrapper. So it is going to fork a few times before it actually starts the service. When I call stop, the &quot;script&quot; gets killed, but not the service.

Worse still, my service requires special handling to be stopped. I can&#039;t just send it a kill, I need to run a command. Suppose it&#039;s a kernel module or a driver that I&#039;m running.

How can I specify the means to stop the service? Is there a &quot;stop&quot; section for that, as there is &quot;script&quot; in addition to simply &quot;exec&quot; to specify how to start?

Or should I let Upstart simply kill the &quot;script&quot; section and do the actual killing in post-start?

I don&#039;t want to employ dirty hack. What is the intended way?

Thanks!
Alex</description>
		<content:encoded><![CDATA[<p>Hi Scott,</p>
<p>A question. Suppose I have a service that uses lots of wrappers to start. I use a &#8220;script&#8221; instead of an &#8220;exec&#8221; to start it, and from that script I call the topmost wrapper. So it is going to fork a few times before it actually starts the service. When I call stop, the &#8220;script&#8221; gets killed, but not the service.</p>
<p>Worse still, my service requires special handling to be stopped. I can&#8217;t just send it a kill, I need to run a command. Suppose it&#8217;s a kernel module or a driver that I&#8217;m running.</p>
<p>How can I specify the means to stop the service? Is there a &#8220;stop&#8221; section for that, as there is &#8220;script&#8221; in addition to simply &#8220;exec&#8221; to specify how to start?</p>
<p>Or should I let Upstart simply kill the &#8220;script&#8221; section and do the actual killing in post-start?</p>
<p>I don&#8217;t want to employ dirty hack. What is the intended way?</p>
<p>Thanks!<br />
Alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saint DanBert</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1136</link>
		<dc:creator>Saint DanBert</dc:creator>
		<pubDate>Sat, 13 Dec 2008 04:21:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1136</guid>
		<description>All of this is very much like the room full of mouse traps and balls. Great technology, but almost non-deterministic in how whatever happens. I&#039;m thrilled that it mostly works. However, some of us have parts that don&#039;t work. Sadly, we lack enough information to (1)instrument our situation, (2) gather details about whatever is going on, (3) seek help by sharing what we know and asking questions, and (4)fix our individual problem and share the solution.

I&#039;ve done some very sophisticated embedded system event driven applications. For what I know about upstart, it will be a wonderful improvement. We need help to watch the bouncing balls and work with this thing.

~~~ Saint 8d;-)</description>
		<content:encoded><![CDATA[<p>All of this is very much like the room full of mouse traps and balls. Great technology, but almost non-deterministic in how whatever happens. I&#8217;m thrilled that it mostly works. However, some of us have parts that don&#8217;t work. Sadly, we lack enough information to (1)instrument our situation, (2) gather details about whatever is going on, (3) seek help by sharing what we know and asking questions, and (4)fix our individual problem and share the solution.</p>
<p>I&#8217;ve done some very sophisticated embedded system event driven applications. For what I know about upstart, it will be a wonderful improvement. We need help to watch the bouncing balls and work with this thing.</p>
<p>~~~ Saint 8d;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Drechsel</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-1084</link>
		<dc:creator>Eric Drechsel</dc:creator>
		<pubDate>Thu, 04 Sep 2008 07:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-1084</guid>
		<description>Thanks, Scott, for the great introduction! I&#039;m using upstart to run various fastcgi processes in Hardy.

Is this the only/best documentation available for writing jobs (other than the source I mean)?</description>
		<content:encoded><![CDATA[<p>Thanks, Scott, for the great introduction! I&#8217;m using upstart to run various fastcgi processes in Hardy.</p>
<p>Is this the only/best documentation available for writing jobs (other than the source I mean)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giko</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-861</link>
		<dc:creator>giko</dc:creator>
		<pubDate>Wed, 25 Jun 2008 12:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-861</guid>
		<description>Hi,

I want to trigger a script when a device (.f.ex. usb dongle, usb bluetooth etc) i removed. I read that upstart can be triggert on these events (emitet by the kernel, hal or dbus) but i do not know the name &quot;?&quot; of the event to trigger on.  Could you help me out there? /giko</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I want to trigger a script when a device (.f.ex. usb dongle, usb bluetooth etc) i removed. I read that upstart can be triggert on these events (emitet by the kernel, hal or dbus) but i do not know the name &#8220;?&#8221; of the event to trigger on.  Could you help me out there? /giko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frymaster</title>
		<link>http://www.netsplit.com/2008/04/27/upstart-05-events/comment-page-1/#comment-826</link>
		<dc:creator>Frymaster</dc:creator>
		<pubDate>Mon, 28 Apr 2008 13:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.netsplit.com/?p=147#comment-826</guid>
		<description>The only annoying this about upstart as-is (I can&#039;t comment on upstart 5 which is upstart as-it-will-be) is I have literally no clue which of these keywords are in the version of upstart in my distro (which is version 0.3.8), or indeed which other keywords NOT described are there, or what they might do.

While there is a very good getting started guide on this webite, it is pretty much the only documentation that exists, and it _IS_ only useful for getting started, not finished.  &quot;man event.d&quot; does nothing, &quot;man upstart&quot; does nothing, &quot;man init&quot; leads via the &quot;see also&quot; section to initctl, which is interesting but also doesn&#039;t help in writing the things.  The example jobs are of the very simple kind and are similarly unhelpful. (The existance of a pre-stop script and a post-start was inferred from the existing examples, but aren&#039;t explicitly mentioned anywhere)

Just from what has been casually dropped in here and on I know there&#039;s a &quot;task&quot; keyword, but have no idea what that means.  There are tantalising hints to some kind of logging facility (which is what I&#039;m tearing my hair out over at the moment) but I have no idea how to invoke it, or even to redirect output somewhere sensible, other than redirecting at the end of the line calling the program (which then triggers that app&#039;s very annoying let&#039;s-buffer-1-screen-at-a-time mode).  If I put the app at the beginning of a pipe, stopping the job kills the shell that&#039;s calling the program without killing the program itself and I have no idea how to fix it.  I have no clue what events might fire on my system, or what might decide to fire them, and have no systematic way of finding out.  I have no idea how to carry state information forward from pre-start scripts to the start script itself, other than creating tons of temp files.

In short, I need documentation :(</description>
		<content:encoded><![CDATA[<p>The only annoying this about upstart as-is (I can&#8217;t comment on upstart 5 which is upstart as-it-will-be) is I have literally no clue which of these keywords are in the version of upstart in my distro (which is version 0.3.8), or indeed which other keywords NOT described are there, or what they might do.</p>
<p>While there is a very good getting started guide on this webite, it is pretty much the only documentation that exists, and it _IS_ only useful for getting started, not finished.  &#8220;man event.d&#8221; does nothing, &#8220;man upstart&#8221; does nothing, &#8220;man init&#8221; leads via the &#8220;see also&#8221; section to initctl, which is interesting but also doesn&#8217;t help in writing the things.  The example jobs are of the very simple kind and are similarly unhelpful. (The existance of a pre-stop script and a post-start was inferred from the existing examples, but aren&#8217;t explicitly mentioned anywhere)</p>
<p>Just from what has been casually dropped in here and on I know there&#8217;s a &#8220;task&#8221; keyword, but have no idea what that means.  There are tantalising hints to some kind of logging facility (which is what I&#8217;m tearing my hair out over at the moment) but I have no idea how to invoke it, or even to redirect output somewhere sensible, other than redirecting at the end of the line calling the program (which then triggers that app&#8217;s very annoying let&#8217;s-buffer-1-screen-at-a-time mode).  If I put the app at the beginning of a pipe, stopping the job kills the shell that&#8217;s calling the program without killing the program itself and I have no idea how to fix it.  I have no clue what events might fire on my system, or what might decide to fire them, and have no systematic way of finding out.  I have no idea how to carry state information forward from pre-start scripts to the start script itself, other than creating tons of temp files.</p>
<p>In short, I need documentation <img src='http://www.netsplit.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
