[systemd-devel] systemd195: issue with udev launched script

Warpme warpme at o2.pl
Sun Nov 25 06:35:07 PST 2012


On 11/25/12 1:24 PM, Andrey Borzenkov wrote:
> В Fri, 16 Nov 2012 17:37:27 +0100
> Warpme <warpme at o2.pl> пишет:
>
>> [Service]
>> ExecStart=/usr/local/bin/run-backup.sh
>> Type=forking
>> GuessMainPID=false
>> RemainAfterExit=no
>>
>>
>>
>> Issue:
>> it works with:
>> ENV{ID_FS_LABEL_ENC}==".myth.backup", RUN+="/usr/bin/systemctl start
>> ext-usb-backup.service"
>>
> Is your actual backup program started in background by run-backup.sh
> and script itself exits? Because that is what is implied by
> Type=forking. If yes, it apparently takes over 30 seconds as systemctl
> is killed by udev. You probably want to use "systemctl --no-block" in
> this case.
Andrey,
Thx for Your post.
Indeed forking is bad idea. I changed it to oneshot and it works OK.
>
>> but not works with:
>> ENV{ID_FS_LABEL_ENC}==".myth.backup", TAG+="systemd",
>> ENV{SYSTEMD_WANTS}="ext-usb-backup.service"
>>
> Hard to tell without systemd debug output. You can enable it online by
> sending signal to systemd, see man page.
>
I found issue: when developing udev rule I tested it via:

udevadm trigger --sysname-match=sdc1 --action=add

This seems to correctly launch actions within udev but NOT in systemd.
However, when I physically connect USB device it works.

Also I have another interesting observation:

My udev rule has:

TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="ext-usb-backup@$env{ID_FS_LABEL_ENC}\x20connected.service"

My unit has something like this:

ExecStart=/bin/sh -c "/usr/bin/perl /usr/local/bin/osd_notify.pl %I 
connected backup"

So for HDD with label ".myth.backup", osd_notify.pl should have 
parameters like: ".myth.backup connected backup"

but in reality it has: 
"sys/devices/pci0000:00/0000:00:09.0/0000:04:00.0/usb3/3-1/3-1:1.0/host12/target12:0:0/12:0:0:0/block/sdc/sdc1 
connected backup"

but when I change rule to:

TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="ext-usb-backup@\x20$env{ID_FS_LABEL_ENC}\x20connected.service"

it think it is result of bug in systemd....

-------------- next part --------------
A non-text attachment was scrubbed...
Name: warpme.vcf
Type: text/x-vcard
Size: 83 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20121125/ffe9e98c/attachment.vcf>


More information about the systemd-devel mailing list