systemctl stop autopweroff does not kill the process
it-jonas opened this issue · 1 comments
it-jonas commented
If autopoweroff is stopped by systemctl stop autopoweroff
the deamon stops but the process keeps running.
See here:
jonas@pc-test:~$ ps -aux | grep [a]utopoweroff
jonas@pc-test:~$ sudo systemctl start autopoweroff.service
jonas@pc-test:~$ sudo systemctl status autopoweroff.service
● autopoweroff.service - LSB: Start daemon at boot time
Loaded: loaded (/etc/init.d/autopoweroff; generated)
Active: active (running) since Tue 2022-09-27 18:33:21 CEST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 24388 ExecStart=/etc/init.d/autopoweroff start (code=exited, status=0/SUCCESS)
Tasks: 12 (limit: 4566)
Memory: 9.2M
CPU: 153ms
CGroup: /system.slice/autopoweroff.service
└─24395 python3 /usr/sbin/autopoweroffd
Sep 27 18:33:21 pc-test systemd[1]: Starting LSB: Start daemon at boot time...
Sep 27 18:33:21 pc-test autopoweroff[24388]: * Starting Autopoweroff...
Sep 27 18:33:21 pc-test autopoweroff[24388]: ...done.
Sep 27 18:33:21 pc-test systemd[1]: Started LSB: Start daemon at boot time.
Sep 27 18:33:21 pc-test autopoweroffd[24395]: Autopoweroff started with PID '24395'.
Sep 27 18:33:21 pc-test autopoweroffd[24395]: Reading configuration file: /etc/autopoweroff/autopoweroff.conf
Sep 27 18:33:21 pc-test autopoweroffd[24395]: Command to execute when all conditions are met: /usr/sbin/alt_hibernation.sh
Sep 27 18:33:22 pc-test autopoweroffd[24395]: Startup sleep of 5 minutes.
jonas@pc-test:~$ ps -aux | grep [a]utopoweroff
root 24395 0.4 0.3 836716 14992 ? Sl 18:33 0:00 python3 /usr/sbin/autopoweroffd
jonas@pc-test:~$ sudo systemctl stop autopoweroff.service
jonas@pc-test:~$ ps -aux | grep [a]utopoweroff
root 24395 0.2 0.3 836716 14992 ? Sl 18:33 0:00 python3 /usr/sbin/autopoweroffd
jonas@pc-test:~$ sudo cat /var/run/autopoweroff/autopoweroff.pid
11300jonas@pc-test:~$
jonas@pc-test:~$ for psid in $(ps -aux | grep [a]utopoweroff | awk '{print $2}'); do kill -9 $psid; done
-bash: kill: (24395) - Vorgang nicht zulässig
jonas@pc-test:~$ for psid in $(ps -aux | grep [a]utopoweroff | awk '{print $2}'); do sudo kill -9 $psid; done
I fixed it with a dirty workaround by adding a line to the /etc/init.d/autopoweroff
:
for psid in $(ps -aux | grep [a]utopoweroff | awk '{print $2}'); do kill -9 $psid; done