You are not logged in.

#1 2017-05-08 11:13:23

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,481

[SOLVED] Systemd user timer, what's the correct OnCalendar syntax?

Hi all, I made a new systemd timer and associated unit:

##########################################################
koko@Gozer# cat /home/koko/.config/systemd/user/buongiorno.timer 
[Unit]
Description=Notifiche mattutine

[Timer]
OnCalendar=*-*-* 08:00:00
Persistent=true     


[Install]
WantedBy=timers.target

##########################################################
koko@Gozer# cat /home/koko/.config/systemd/user/buongiorno.service 
[Unit]
Description=Notifiche mattutine

[Service] 
Type=forking
ExecStart=/home/koko/scripts/buongiorno.sh

[Install]
WantedBy=default.target

##########################################################
koko@Gozer# cat /home/koko/scripts/buongiorno.sh
#!/bin/bash
kdialog --sorry 'a message' &
/usr/bin/soffice adocument.ods &


##########################################################
koko@Gozer# systemctl --user list-timers --all
NEXT LEFT LAST                          PASSED     UNIT                     ACTIVATES
n/a  n/a  Sat 2017-05-06 08:00:56 CEST  2 days ago buongiorno.timer         buongiorno.service
n/a  n/a  Fri 2017-05-05 08:00:56 CEST  3 days ago messaggiomattutino.timer

2 timers listed.

##########################################################
koko@Gozer# systemctl --user status buongiorno.timer
● buongiorno.timer - Notifiche mattutine
   Loaded: loaded (/home/koko/.config/systemd/user/buongiorno.timer; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-05-05 11:01:10 CEST; 3 days ago

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

##########################################################
koko@Gozer# journalctl --user|grep buongiorno
mag 06 08:00:56 Gozer buongiorno.sh[15314]: Xlib:  extension "XINERAMA" missing on display ":2".

I can't figure out why my timer just run once.
Anybody?

Thanks.

-EDIT-
Wrong, it seems it doesn't even start the first time, i suspect calendar directive is invalid.
I'd like it to run every morning at 8:00 am, but i'm unable to figure out on my own.

-EDIT-
Ok, got it, even if systemd trows no error, it seems that OnCalendar requires the specification of the days so, it seems to work with the following:

OnCalendar=Mon..Sun *-*-* 08:00:00

Last edited by kokoko3k (2017-05-08 11:33:01)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB