<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hi James<div><br></div><div>Yes I did read the cookbook part about instance, but was still a little confused ... will probably wait till I need it :)</div><div><br></div><div>I do understand what you have said about adding mounting but not sure I can see an easy way</div><div>to implement as I try to keep my scripts fairly generic so as to not have a user required to edit later.</div><div>This being said I may not know exactly what will be mounted so unable to add mounting prior</div><div>to it occurring. I do not however see this as a big issue (yet) as I see nothing that would currently require</div><div>to know when this is happening.</div><div><br></div><div>An issue I have run into with my approach is as follows:</div><div><br></div><div>I have altered the snippet below to look like - </div><div><br></div><div>while read -r MOUNT C_TYPE</div><div>do</div><div> initctl emit mounted MOUNTPOINT=$MOUNT TYPE=$C_TYPE</div><div>done</proc/mounts</div><div><br></div><div>(This would also make it easy to add DEVICE and OPTIONS as all are contained here)</div><div><br></div><div>The issue that is being caused is that if I ask a script to do the following - </div><div><br></div><div>start on ( mounted MOUNTPOINT=/dev TYPE=/devtmpfs</div><div> and mounted MOUNTPOINT=/sys )</div><div><br></div><div>This never runs. I am guessing as the emits happen sequentially and the clause is using 'and'</div><div>that these 2 things are not true at the same time??</div><div><br></div><div>Now I noticed from the cookbook and the man page of upstart-events that mountall emits these as</div><div>a hook, defined as:</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 12px; line-height: 12px; "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; ">Hook - Blocking. Waits for events that <b>start</b> <b>on</b> or <b>stop</b> <b>on</b> this</pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; "><br></pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; ">Is there a way for me to emit mine in a similar fashion?</pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; "><br></pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; ">cheers</pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; ">grail</pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; "><br></pre><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; ">PS. Thanks for all the information</pre></span><br>> Date: Wed, 25 May 2011 14:24:39 +0100<br>> From: james.hunt@canonical.com<br>> To: grail69@hotmail.com<br>> CC: upstart-devel@lists.ubuntu.com<br>> Subject: Re: What emits mounted event?<br>> <br>> -----BEGIN PGP SIGNED MESSAGE-----<br>> Hash: SHA1<br>> <br>> Hi Grail,<br>> <br>> On 24/05/11 02:14, Grail Dane wrote:<br>> > Well that was a quick and easy test :)<br>> > <br>> > I would like to add an additional question, if in my mountall.conf I<br>> > place a loop to go through all<br>> > mounted items, as per the output of mount, and issued a similar line to<br>> > below, would<br>> > I need to use 'anything' to tie the MOUNTPOINT and TYPE to the specific<br>> > call?<br>> > <br>> > eg.<br>> > <br>> > while read -r M T<br>> > do<br>> > initctl emit mounted MOUNTPOINT=$M TYPE=$T<br>> > done< <(mount | awk '{print $3,$5}')<br>> > <br>> > Will this be enough for anything listening or would MOUNTPOINT and TYPE<br>> > need to last longer and so<br>> > somehow be individual, maybe using instance? (not a full bottle on how<br>> > to use that just yet)<br>> You shouldn't need to use "instance" - /sbin/mountall doesn't. There is<br>> some info on the instance stanza in the cookbook if you're interested<br>> though:<br>> <br>> http://upstart.ubuntu.com/cookbook/#instance<br>> <br>> Bear in mind that if you want to provide an environment like that on<br>> Ubuntu, you should emit both a mounting(7) and a mounted(7) event. See:<br>> <br>> http://manpages.ubuntu.com/manpages/natty/en/man7/mounting.7.html<br>> http://manpages.ubuntu.com/manpages/natty/en/man7/mounted.7.html<br>> <br>> You might also want to set the DEVICE and OPTIONS variables.<br>> <br>> The loop idea should work since by that stage all the devices will<br>> already be mounted, but of course that's not what /sbin/mountall does -<br>> it emits the events *as* the device is mounted. All that should mean for<br>> you though is that jobs that "start on mounting" / "start on mounted"<br>> will start slightly later than the possibly could do (but rather that<br>> than having them start too early :-)<br>> <br>> Regards,<br>> <br>> James.<br>> <br>> > <br>> > The idea I am shooting for is to allow others to potentially use 'start<br>> > on mounted' for anything within the system.<br>> > <br>> > cheers<br>> > grail<br>> > <br>> > ------------------------------------------------------------------------<br>> > From: grail69@hotmail.com<br>> > To: upstart-devel@lists.ubuntu.com<br>> > Subject: RE: What emits mounted event?<br>> > Date: Tue, 24 May 2011 00:46:15 +0000<br>> > <br>> > Hi James<br>> > <br>> > Thank you very much for the suggestion below. I did actually find<br>> > something on this in the Cookbook (like I said I think it is a great<br>> > piece of literature for those of us trying to learn :) )<br>> > <br>> > I will definitely take your advice on raising examples<br>> > <br>> > cheers<br>> > grail<br>> > <br>> >> Date: Mon, 23 May 2011 20:14:22 +0100<br>> >> From: james.hunt@ubuntu.com<br>> >> To: grail69@hotmail.com<br>> >> CC: upstart-devel@lists.ubuntu.com<br>> >> Subject: Re: What emits mounted event?<br>> >><br>> >> Hi Grail,<br>> >><br>> >> On 23/05/11 05:09, Grail Dane wrote:<br>> >> > Ahhh ... I thought it might have been ... hence my issue :(<br>> >> ><br>> >> > In that case, is there an alternative if you are using simple mount<br>> > command?<br>> >> Although a vanilla Upstart system won't provide you with the mounted<br>> >> event, you can of course emit such an event yourself:<br>> >><br>> >> initctl emit mounted MOUNTPOINT=/var/run ...<br>> >><br>> >> ><br>> >> > cheers<br>> >> > grail<br>> >> ><br>> >> > PS.<br>> >> > I have been recently reading through the Cookbook that was talked about<br>> >> > here a little while back.<br>> >> > Unfortunately it is Ubuntu centric and does not give the standard option<br>> >> > as well as the Ubuntu<br>> >> > version :( (maybe others would be interested in starting an upstart<br>> >> > cookbook)<br>> >> The cookbook is Ubuntu-centric in a sense, but we have gone to some<br>> >> pains to point out Ubuntu-specific differences:<br>> >><br>> >> http://upstart.ubuntu.com/cookbook/#ubuntu-specific<br>> >> http://upstart.ubuntu.com/cookbook/#ubuntu-transient<br>> >><br>> >> The fact that it does tend to cover Ubuntu more fully is because the<br>> >> authors are working with Upstart on Ubuntu and also the O/S most users<br>> >> are most likely to come across with Upstart installed is Ubuntu.<br>> >><br>> >> That said, it makes a lot of sense to outline where appropriate the<br>> >> "generic" methodology so we'll try to bear this in mind for future<br>> >> updates. If you have concrete examples of where this would be helpful,<br>> >> please raise bugs on the cookbook itself:<br>> >><br>> >> https://bugs.launchpad.net/upstart-cookbook/+filebug<br>> >><br>> >> > So I have been struggling to find options to create scripts based on<br>> >> > standard applications (by<br>> >> > standard i am talking from an (C)LFS point of view and without any other<br>> >> > SysV reliance)<br>> >> Again, please raise bugs for specific scenarios.<br>> >><br>> >> Regards,<br>> >><br>> >> James<br>> >><br>> >> ><br>> >> >> Date: Mon, 23 May 2011 13:40:59 +1000<br>> >> >> From: apollock@debian.org<br>> >> >> To: grail69@hotmail.com<br>> >> >> CC: upstart-devel@lists.ubuntu.com<br>> >> >> Subject: Re: What emits mounted event?<br>> >> >><br>> >> >> On Mon, May 23, 2011 at 03:28:57AM +0000, Grail Dane wrote:<br>> >> >> ><br>> >> >> > Hi All<br>> >> >> > I have been looking over some of the Ubuntu upstart scripts to see<br>> >> > what can help me.<br>> >> >> > I tried using the mounted-varrun.conf script but for some reason my<br>> >> > system doesn't seem to pass on thefact that /var/run is mounted. I have<br>> >> > found though that if after the system has started and I login, I am able<br>> >> > to enter the following:<br>> >> >> > start mounted-varrun<br>> >> >> > This does then successfully follow the script and perform the<br>> >> > actions as specified<br>> >> >> > Is anyone able to tell me why this is not captured during the<br>> >> > startup process?<br>> >> >> > cheersgrail<br>> >> >><br>> >> >> I can't help with your specific problem, but the mountall program<br>> >> > (from the<br>> >> >> mountall package) emits the mounted event (at least in Ubuntu 10.04)<br>> >> >><br>> >> >> regards<br>> >> >><br>> >> >> Andrew<br>> >> ><br>> >><br>> > <br>> > -- upstart-devel mailing list upstart-devel@lists.ubuntu.com Modify<br>> > settings or unsubscribe at:<br>> > https://lists.ubuntu.com/mailman/listinfo/upstart-devel<br>> > <br>> <br>> <br>> - -- <br>> Cheers,<br>> <br>> James.<br>> - --<br>> James Hunt<br>> ____________________________________<br>> Ubuntu Foundations Team, Canonical.<br>> -----BEGIN PGP SIGNATURE-----<br>> Version: GnuPG v1.4.11 (GNU/Linux)<br>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/<br>> <br>> iEYEARECAAYFAk3dAxcACgkQYBWEaHcQG9f1qgCcCvdZDQn7SGaUKF+4LCHBiOpk<br>> vAYAniY2ujSDqiwuBKlaFFtfxAxttQEl<br>> =Q6fQ<br>> -----END PGP SIGNATURE-----<br></div> </body>
</html>