Am 06.07.2015 um 09:29 schrieb Ritesh Raj Sarraf: > rrs@learner:~$ cat /lib/udev/lmt-udev > #!/bin/sh -e > # /usr is not guaranteed to be mounted when udev starts > > ( > if grep -w "systemd" /proc/1/conn; then > systemctl --non-block reload laptop-mode > > elif [ -e /lib/udev/hotplug.functions ]; then
> ) </dev/null >/dev/null 2>&1 & > Please just confirm if this is the right approach, and I'll update the > changes at other invokers too. Something like that is going in the right direction. You are backgrounding the subshell here, so there might still be issue that the lmt-udev script is killed before you can call systemctl. So I suspect there is still a race condition. I guess you could test that by simply adding a sleep 10 before systemctl --non-block. I would suggest moving the systemctl code outside of the backgrounded subshell, i.e. the ( ) ... code block See [1] as an example. > BTW, Is this the reliable way to detect if systemd is the active running > init ? The canonical way to check if systemd is the active PID 1 is a simple test for the existence of the /run/systemd/systemd directory [2] In shell this would be if [ -d /run/systemd/systemd ] ; then do stuff fi Michael [1] https://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/extra/udev-helpers/net.agent#n106 [2] http://www.freedesktop.org/software/systemd/man/sd_booted.html -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature