systemd user timers (cron alternative)

After system reinstall I had some issues fixing my user systemd timers. Because I copied the files from backup to .config/systemd/user/ the system yell at me with Failed to execute operation: Invalid argument
After googling I found solution at http://stackoverflow.com/a/33363732/289404

I had disabled timer-{daily,weekly,hourly}.timer

$ systemctl --user list-unit-files
UNIT FILE                  STATE
dbus.service               indirect
mpd.service                disabled
mpdas.service              enabled 
systemd-bus-proxyd.service static
systemd-exit.service       static
dbus.socket                disabled
systemd-bus-proxyd.socket  static
basic.target               static
bluetooth.target           static
busnames.target            static
default.target             static
exit.target                static
paths.target               static
printer.target             static
shutdown.target            static
smartcard.target           static
sockets.target             static
sound.target               static
timer-daily.target         static
timer-hourly.target        static
timer-weekly.target        static
timers.target              static
timer-daily.timer          disabled
timer-hourly.timer         disabled
timer-weekly.timer         disabled

So after

$ rm ~/.config/systemd/user/basic.target.wants/timer-*

and

$ systemctl --user enable timer-weekly.timer
$ systemctl --user enable timer-daily.timer
$ systemctl --user enable timer-hourly.timer

I got the timers enabled

 $ systemctl --user list-unit-files |grep timer
timer-daily.target         static  
timer-hourly.target        static  
timer-weekly.target        static  
timers.target              static  
timer-daily.timer          enabled 
timer-hourly.timer         enabled 
timer-weekly.timer         enabled

Great how-to is at https://blog.higgsboson.tk/2013/06/09/use-systemd-as-a-cron-replacement/

systemd timer daily at specific time

I had to change the daily timers time of execution, I wanted it to start at 8am so had to change ~/.config/systemd/user/timer-daily.timer from monotonic to realtime.

[Unit]
Description=Daily Timer

[Timer]
# OnBootSec=10min
# OnUnitActiveSec=1d
# Daily at 8am
OnCalendar=*-*-* 08:00:00
Persistent=True
Unit=timer-daily.target

[Install]
WantedBy=basic.target

Next daemon-reload

$ systemctl --user daemon-reload

And voila:

$ systemctl --user list-timers
NEXT                         LEFT        LAST                         PASSED        UNIT               ACTIVATES
Sun 2015-02-15 09:47:17 CET  18min left  Sun 2015-02-15 08:47:17 CET  41min ago     timer-hourly.timer timer-hourly.target
Mon 2015-02-16 08:00:00 CET  22h left    Sun 2015-02-15 09:28:14 CET  25s ago       timer-daily.timer  timer-daily.target
Fri 2015-02-20 10:21:17 CET  5 days left Fri 2015-02-13 10:21:17 CET  1 day 23h ago timer-weekly.timer timer-weekly.target

For more about systemd.timer check http://www.freedesktop.org/software/systemd/man/systemd.timer.html