Sample Header Ad - 728x90

Run an update *one* time at shutdown – systemd-run?

3 votes
3 answers
328 views
I've got a few things that I don't want to update while my graphical session is running, but would be happy to have them updated on shutdown (after my graphical session ended, while network is still up), *once*. So, I don't want to write a service file, enable it, and then have it run at *every* shutdown. Now, I thought, OK, systemd-run to the rescue:
systemd-run \
           --property=Type=oneshot \
           --property=DefaultDependencies=no \
           --property=Requires=network.service \
           --property=WantedBy=shutdown.target \
           /usr/bin/dnf5 update -y package1 packge2…
But that fails with
Failed to start transient service unit: Dependency type WantedBy may not be created transiently.
Is there another way to this?
Asked by Marcus Müller (47272 rep)
Jul 26, 2024, 06:14 PM
Last activity: Sep 14, 2024, 06:20 AM