You are not logged in.
Pages: 1
Topic closed
Hello,
I'm trying to install a systemd timer. I have (nearly) the exactly configuration on two different systems, but the timer only works on one of them.
I installed the timer using systemctl enable --user --now autosync.timer (See autosync.timer and autosync.service below).
working system:
$ systemctl list-timers --all --user
NEXT LEFT LAST PASSED UNIT ACTIVATES
Sat 2020-07-11 13:59:02 CEST 5min left Sat 2020-07-11 12:59:02 CEST 54min ago autosync.timer autosync.service
1 timers listed.non working system:
$ systemctl list-timers --user --all
NEXT LEFT LAST PASSED UNIT ACTIVATES
n/a n/a Sun 2020-03-22 01:44:34 CET 3 months 20 days ago autosync.timer autosync.service
1 timers listed.
$ systemctl status --user autosync.timer
● autosync.timer - Synchronise every hour
Loaded: loaded (/etc/xdg/systemd/user/autosync.timer; enabled; vendor preset: enabled)
Active: active (elapsed) since Sat 2020-07-11 13:41:54 CEST; 18min ago
Trigger: n/a
Triggers: ● autosync.service
Jul 11 13:41:54 yoga systemd[711]: Started Synchronise every hour.
Warning: journal has been rotated since unit was started and some journal files were not opened due to insufficient permissions, output may be incomplete.Does anyone know why the timer does not work on my machine?
/etc/systemd/user/autosync.timer:
[Unit]
Description=Synchronise every hour
[Timer]
OnBootSec=10s
OnUnitActiveSec=1hour
Persistent=true
Unit=autosync.service
[Install]
WantedBy=timers.target/etc/systemd/user/autosync.service:
[Unit]
Description=Synchronises ILA data
[Service]
Type=simple
ExecStart=/home/volker/SIMTAP_DIR/unison/autosync.shUPDATE:
I removed the Persistent=true line and now it works. The fact that it does not work with Persistent=true seems to be a bug:
https://bugs.archlinux.org/task/67384
Last edited by volker_weissmann (2020-07-24 17:44:08)
Offline
When next time is n/a, what is the output of
systemctl status --user autosync.servicePlease use code tags for commands and their outputs.
Offline
$ systemctl status --user autosync.service
● autosync.service - Synchronises ILA data
Loaded: loaded (/etc/xdg/systemd/user/autosync.service; static; vendor preset: enabled)
Active: inactive (dead)
TriggeredBy: ● autosync.timerOffline
OnUnitActiveSec specifies a time relative to the last activation of the service. If the service has not been activated there is no such time hence the n/a.
Offline
But I also have OnBootSec=10s. That's how the the wiki does it.
Offline
What is the output of
systemctl status --user timers.target
systemctl list-dependencies --user timers.targetOffline
$ systemctl status --user timers.target
● timers.target - Timers
Loaded: loaded (/usr/lib/systemd/user/timers.target; static; vendor prese>
Active: active since Sat 2020-07-11 13:41:54 CEST; 22h ago
Docs: man:systemd.special(7)
Jul 11 13:41:54 yoga systemd[711]: Reached target Timers.$ systemctl list-dependencies --user timers.target
timers.target
● └─autosync.timerOffline
The timer unit starts and expires but the service it starts was not activated?
What is in the journal for the service and timer
journalctl --user -b -u autosync.timer -u autosync.serviceOffline
$ journalctl --user -b -u autosync.timer -u autosync.service
-- Logs begin at Sun 2020-01-05 23:21:59 CET, end at Sun 2020-07-12 23:40:45 CEST. --
Jul 12 12:29:21 yoga systemd[777]: Started Synchronise every hour.Offline
I had this same issue and found the solution. From the systemd timer documentation:
Use systemctl clean --what=state … on the timer unit to remove the timestamp file maintained by this option from disk. In particular, use this command before uninstalling a timer unit. See systemctl(1) for details.
At some point my system must have messed up this timestamp file. Using the clean command fixed it. I can still have
Persistent=trueOffline
Thank you for the post, but be aware that this thread is almost six years old....
Using this opportunity to close this old thread.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed