2012/11/18 Warpme <[email protected]>

> Well,
> Things pretend to be simple seems to be not simple
> After 2 days of fighting with issue I have to ask for help.
> I want to kick systemd service when usb HDD is plugged.
> As started service needs to know HDD label I wan to use templates.
> Here is what it goes:
>
> udev rule:
> SUBSYSTEM=="block", KERNEL=="sd[c-z][0-9]", GOTO="begin"
> GOTO="end"
> LABEL="begin"
>    ACTION=="add", GOTO="begin_add"
>    ACTION=="remove", GOTO="begin_remove"
>    GOTO="end"
>
> LABEL="begin_add"
>    SYMLINK+="usbhd-%k", GROUP="root"
>    ENV{ID_FS_LABEL_ENC}="usbhd-%**k"
>    IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
>    ENV{ID_FS_LABEL_ENC}==".myth.**backup", 
> ENV{MOUNT_DIR}="/media/$env{**ID_FS_LABEL_ENC}",
> RUN+="/bin/mkdir -p $env{MOUNT_DIR}", RUN+="/bin/mount -t auto -o
> rw,noauto,noatime /dev/%k $env{MOUNT_DIR}"
>    ENV{ID_FS_LABEL_ENC}==".myth.**backup", TAG+="systemd",
> ENV{SYSTEMD_WANTS}="ext-usb-**backup.service"
>    GOTO="end"
>
>
>
> service file:
> [Unit]
> Description=MythtTV ExtUSB Backup Helper
>
> [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"
>
> but not works with:
> ENV{ID_FS_LABEL_ENC}==".myth.**backup", TAG+="systemd",
> ENV{SYSTEMD_WANTS}="ext-usb-**backup.service"
>
> (With TAG+ENV approach udev behaves like line with TAG+ENV is
> non-existing: no any error nor any sign it is parsed)
>
> Where the issue is ?
>
> Thx in advance !
>
 Hi

I don't really have an idea, but here are some things you could check
additionally:
Does systemd create a .device unit? And if yes is it active/plugged? And
does it have the correct "Wants=ext-usb-backup.service" attribute? Does
udevadm info --query=property --path=<path to sysfs device> show the
correct values for
SYSTEMD_WANTS and TAGS?

Mirco
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to