<div dir="ltr"><div>will try in this way.</div><div>thanks for feedback.</div><div><br></div><div>regards, lacsaP.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 20 mai 2022 à 19:38, Mike Gilbert <<a href="mailto:floppym@gentoo.org">floppym@gentoo.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, May 20, 2022 at 1:34 PM Mike Gilbert <<a href="mailto:floppym@gentoo.org" target="_blank">floppym@gentoo.org</a>> wrote:<br>
><br>
> On Fri, May 20, 2022 at 12:54 PM Pascal <<a href="mailto:patatetom@gmail.com" target="_blank">patatetom@gmail.com</a>> wrote:<br>
> ><br>
> > not really in the sense that qemu-nbd launches and immediately gives the hand back to the script that called it.<br>
> > the script ends positively and qemu-nbd is killed by systemd because it is considered to be garbage left behind by the script.<br>
> > this is not quite the case of a timeout that systemd terminates, but the result is the same.<br>
> > in this case, qemu-nbd looks more like a daemon.<br>
> ><br>
> > I was wondering if there was a way to propagate the killmode through a udev rule that starts a script (like a service)... but it seems from the documentation that the answer is no :-(<br>
> ><br>
> > """In order to activate long-running processes from udev rules, provide a service unit and pull it in from a udev device using the SYSTEMD_WANTS device property. See systemd.device(5) for details."""<br>
> > I would appreciate (and maybe I won't be the only one) a concrete example based, for example, on my problem ;-)<br>
> ><br>
> > let's just say that my rule is :<br>
> ><br>
> > KERNEL=="sdb", RUN+="/usr/local/sbin/myscript"<br>
> ><br>
> > and my script is :<br>
> ><br>
> > #!/usr/bin/bash<br>
> > qemu-nbd -r -s -f raw -c /dev/nbd0 /dev/sdb<br>
><br>
> The most direct translation would be something like this:<br>
><br>
> qemu-nbd0-sdb.service:<br>
> [Service]<br>
> ExecStart=qemu-nbd -r -s -f raw -c /dev/nbd0 /dev/sdb<br>
><br>
> udev rule:<br>
> KERNEL=="sdb", ENV{SYSTEMD_WANTS}+="qemu-nbd0-sdb.service"<br>
<br>
Oh, you'll want to add Type=forking to the .service file if it always<br>
forks a child and exits.<br>
</blockquote></div>