3

I've created a little update/upgrade program for my arch-based linux. Instead of using a cronjob I'm using systemd and created following files:

in /etc/systemd/system: uupgrades.target & uupgrades.timer

[Unit]
Description=UU Upgrades Timer Target
StopWhenUnneeded=yes


[Unit]
Description=UU Upgrades Timer

[Timer]
OnBootSec=8min
OnUnitActiveSec=7h
Unit=uupgrades.target

[Install]
WantedBy=basic.target

in /etc/systemd/system/uupgrades.target.wants I've the uupgrades.service file

[Unit]
Description=UU Update Program

[Service]
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
ExecStart=/usr/bin/uupgrades

and in /etc/systemd/system/basic.target.wants a symlink to uupgrades.timer

What I want to, is just that shutdown, reboot, suspend, hibernate, ... is delayed until uupgrades is not active anymore, when it is active.

How can I achieve this? A GUI/DE still running is not required.

  • Your question is answered in detail in the manual pages... take an inhibitor lock in the executable you are starting.. in this case /usr/bin/uupgrades.. Read the Inhibitor Locks documentation or systemd-inhibit(1) – Cristian Rodríguez Jul 22 '15 at 23:41
0

For the suspend/hibernate/etc. stuff just obtain a logind inhibit. That logind inhibit shoul work for most shutdowns, but you can get around it in some situations I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.