[systemd-devel] systemd195: issue with udev launched script
Colin Guthrie
gmane at colin.guthr.ie
Mon Nov 19 02:54:31 PST 2012
'Twas brillig, and Warpme at 18/11/12 18:38 did gyre and gimble:
> On 11/18/12 5:54 PM, Colin Guthrie wrote:
>
>>
>> Just as a general observation, I don't think you even need to delve into
>> udev rules to make all this work as systemd handles device mounts
>> internally.
>>
>>
>> You can simply create a .mount unit for your drive such that when it is
>> inserted it is mounted automatically (you may have to BindTo= and After=
>> the corresponding .device unit for the external drive IIUC).
>>
>> Then, simply adjust your ext-usb-backup.service to
>> BindTo=your-mount-unit.mount and After=your-mount-unit.mount
>>
>> This means that whenever the mount unit is started (i.e. when ever it's
>> mounted), your service is started immediately after mount.
>>
>>
>> Col
>>
> Col,
> Thx for replay.
> I'm not sure is it possible to launch different actions by different
> vol.labels within .mount unit.
> I have USB HDDs with backups, TVarchives, movies and software.
> Idea is to have solution when attaching USB HDD automatically launches
> appropriate script supporting expected actions (like start backup or
> auto add movies to library).
> It is possible to achieve this .mount units ?
It should be possible to make a .mount unit trigger automatically when a
.device unit shows up.
It should also be possible to make a .service unit trigger automatically
when a .mount unit is started.
The key trick is using BindTo and After as I mentioned above.
I've not analysed your problem totally, but I think it should work
happily without needing to touch udev directly.
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the systemd-devel
mailing list