[systemd-devel] timer unit is run, but service file is not

Mirosław Zalewski miniopl at poczta.onet.pl
Wed Sep 30 12:46:47 PDT 2015


Hi

I have timer unit that is intended to run certain script (wrapped in
service unit) shortly after user login and each hour afterward. This 
has worked perfectly until this week. 

Currently, timer unit is started during user instance of systemd boot
sequence, but associated service unit is never run.

Why is that and how can I fix that?

I have noticed that after login, list-timers command shows "n/a" in all
columns for that one timer:

#v+
$ systemctl --user --all list-timers
NEXT                           LEFT                 LAST                           PASSED              UNIT                 ACTIVATES
n/a                           n/a                  n/a                            n/a                 backup-run.timer     backup-run.service
#v-

If I run service unit manually (systemctl --user start backup-run.service),
then systemd will track next run of timer, but will not be aware of last occurrence:

#v+
systemctl --user --all list-timers 
NEXT                           LEFT                 LAST                           PASSED              UNIT                 ACTIVATES
śro 2015-09-30 21:33:56 CEST  59min left           n/a                            n/a                 backup-run.timer     backup-run.service
#v-

Both next and last run of timer will be tracked only after one full 
cycle after manual run.

So far I have tried:
- disabling and enabling timer unit
- creating ~/.local/share/systemd/timers/stamp-backup-run.timer file 
manually and reloading daemon afterward
But to no avail.

Unit files are pretty straightforward:

#v+
$ systemctl --user cat backup-run.timer
# /home/minio/.config/systemd/user/backup-run.timer
[Unit]
Description=Run backup job - timer unit

[Timer]
OnActiveSec=2m
OnUnitInactiveSec=1h

[Install]
WantedBy=timers.target
$ systemctl --user cat backup-run.service 
# /home/minio/.config/systemd/user/backup-run.service
[Unit]
Description=Run backup job - service unit

[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/home/minio/sources/backup-prompt-user/backup-prompt-user.py
#v-

This is Debian testing machine that hasn't been updated in month or so.

#v+
$ systemctl --version
systemd 225
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
#v-

Thanks in advance
-- 
Best regards
Mirosław Zalewski


More information about the systemd-devel mailing list