What emits mounted event?
James Hunt
james.hunt at canonical.com
Wed May 25 13:24:39 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Grail,
On 24/05/11 02:14, Grail Dane wrote:
> Well that was a quick and easy test :)
>
> I would like to add an additional question, if in my mountall.conf I
> place a loop to go through all
> mounted items, as per the output of mount, and issued a similar line to
> below, would
> I need to use 'anything' to tie the MOUNTPOINT and TYPE to the specific
> call?
>
> eg.
>
> while read -r M T
> do
> initctl emit mounted MOUNTPOINT=$M TYPE=$T
> done< <(mount | awk '{print $3,$5}')
>
> Will this be enough for anything listening or would MOUNTPOINT and TYPE
> need to last longer and so
> somehow be individual, maybe using instance? (not a full bottle on how
> to use that just yet)
You shouldn't need to use "instance" - /sbin/mountall doesn't. There is
some info on the instance stanza in the cookbook if you're interested
though:
http://upstart.ubuntu.com/cookbook/#instance
Bear in mind that if you want to provide an environment like that on
Ubuntu, you should emit both a mounting(7) and a mounted(7) event. See:
http://manpages.ubuntu.com/manpages/natty/en/man7/mounting.7.html
http://manpages.ubuntu.com/manpages/natty/en/man7/mounted.7.html
You might also want to set the DEVICE and OPTIONS variables.
The loop idea should work since by that stage all the devices will
already be mounted, but of course that's not what /sbin/mountall does -
it emits the events *as* the device is mounted. All that should mean for
you though is that jobs that "start on mounting" / "start on mounted"
will start slightly later than the possibly could do (but rather that
than having them start too early :-)
Regards,
James.
>
> The idea I am shooting for is to allow others to potentially use 'start
> on mounted' for anything within the system.
>
> cheers
> grail
>
> ------------------------------------------------------------------------
> From: grail69 at hotmail.com
> To: upstart-devel at lists.ubuntu.com
> Subject: RE: What emits mounted event?
> Date: Tue, 24 May 2011 00:46:15 +0000
>
> Hi James
>
> Thank you very much for the suggestion below. I did actually find
> something on this in the Cookbook (like I said I think it is a great
> piece of literature for those of us trying to learn :) )
>
> I will definitely take your advice on raising examples
>
> cheers
> grail
>
>> Date: Mon, 23 May 2011 20:14:22 +0100
>> From: james.hunt at ubuntu.com
>> To: grail69 at hotmail.com
>> CC: upstart-devel at lists.ubuntu.com
>> Subject: Re: What emits mounted event?
>>
>> Hi Grail,
>>
>> On 23/05/11 05:09, Grail Dane wrote:
>> > Ahhh ... I thought it might have been ... hence my issue :(
>> >
>> > In that case, is there an alternative if you are using simple mount
> command?
>> Although a vanilla Upstart system won't provide you with the mounted
>> event, you can of course emit such an event yourself:
>>
>> initctl emit mounted MOUNTPOINT=/var/run ...
>>
>> >
>> > cheers
>> > grail
>> >
>> > PS.
>> > I have been recently reading through the Cookbook that was talked about
>> > here a little while back.
>> > Unfortunately it is Ubuntu centric and does not give the standard option
>> > as well as the Ubuntu
>> > version :( (maybe others would be interested in starting an upstart
>> > cookbook)
>> The cookbook is Ubuntu-centric in a sense, but we have gone to some
>> pains to point out Ubuntu-specific differences:
>>
>> http://upstart.ubuntu.com/cookbook/#ubuntu-specific
>> http://upstart.ubuntu.com/cookbook/#ubuntu-transient
>>
>> The fact that it does tend to cover Ubuntu more fully is because the
>> authors are working with Upstart on Ubuntu and also the O/S most users
>> are most likely to come across with Upstart installed is Ubuntu.
>>
>> That said, it makes a lot of sense to outline where appropriate the
>> "generic" methodology so we'll try to bear this in mind for future
>> updates. If you have concrete examples of where this would be helpful,
>> please raise bugs on the cookbook itself:
>>
>> https://bugs.launchpad.net/upstart-cookbook/+filebug
>>
>> > So I have been struggling to find options to create scripts based on
>> > standard applications (by
>> > standard i am talking from an (C)LFS point of view and without any other
>> > SysV reliance)
>> Again, please raise bugs for specific scenarios.
>>
>> Regards,
>>
>> James
>>
>> >
>> >> Date: Mon, 23 May 2011 13:40:59 +1000
>> >> From: apollock at debian.org
>> >> To: grail69 at hotmail.com
>> >> CC: upstart-devel at lists.ubuntu.com
>> >> Subject: Re: What emits mounted event?
>> >>
>> >> On Mon, May 23, 2011 at 03:28:57AM +0000, Grail Dane wrote:
>> >> >
>> >> > Hi All
>> >> > I have been looking over some of the Ubuntu upstart scripts to see
>> > what can help me.
>> >> > I tried using the mounted-varrun.conf script but for some reason my
>> > system doesn't seem to pass on thefact that /var/run is mounted. I have
>> > found though that if after the system has started and I login, I am able
>> > to enter the following:
>> >> > start mounted-varrun
>> >> > This does then successfully follow the script and perform the
>> > actions as specified
>> >> > Is anyone able to tell me why this is not captured during the
>> > startup process?
>> >> > cheersgrail
>> >>
>> >> I can't help with your specific problem, but the mountall program
>> > (from the
>> >> mountall package) emits the mounted event (at least in Ubuntu 10.04)
>> >>
>> >> regards
>> >>
>> >> Andrew
>> >
>>
>
> -- upstart-devel mailing list upstart-devel at lists.ubuntu.com Modify
> settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>
- --
Cheers,
James.
- --
James Hunt
____________________________________
Ubuntu Foundations Team, Canonical.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3dAxcACgkQYBWEaHcQG9f1qgCcCvdZDQn7SGaUKF+4LCHBiOpk
vAYAniY2ujSDqiwuBKlaFFtfxAxttQEl
=Q6fQ
-----END PGP SIGNATURE-----
More information about the upstart-devel
mailing list