On 13/01/20 3:03 pm, Lennart Poettering wrote:
On Di, 26.11.19 13:55, Amish (anon.amish@xxxxxxxxx) wrote:
If I change code to not call systemd-inhibit:
$ cat /home/foo/downloads/dnld.sh
#!/bin/bash
/home/foo/downloads/dnld.pl
Then service file runs fine.
# systemctl start dnld.service; sleep 30
# journalctl -u dnld.service
Nov 26 13:50:17 foo systemd[1]: Started Download files.
Nov 26 13:50:37 foo systemd[1]: dnld.service: Succeeded.
So how do I allow systemd-inhibit call when a script is called via systemd
instead of directly?
Is this systemd bug or am I missing something in dnld.service file?
You need to allow this in PolicyKit. if you request an inhibitor from
a login shell you get policykit privs because of the default
policy. If you do this from a non-logged in user you won't, and need
to adjust the policy.
Lennart
I tried changing some PolicyKit settings but I was not successful.
However, I would admit that I did not understand the settings much either.
But how about having this as a feature for systemd.service.
Something like:
[Service]
Inhibit=shutdown,sleep,idle,...
InhibitMode=block|delay
ExecStart=...
So before running any command, systemd will inhibit accordingly. (can be
useful even when run with User=foo set)
Any critical service which does not expect shutdown, reboot etc. can use
this feature to block / delay the same while it is running.
I can file RFE if you want.
Thanks and regards,
Amish.
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel