Systemd timer rsnapshot weekly

systemd

I've configured a systemd timer for a hourly, daily and weekly backup with rsnapshot on an external HD.

When I'm at work HD it's connected and I've configured rsnapshot.conf with option

no_create_root  1

so that if backup path is not present directory is not created and backup is not done.

My problem is that when the time of the backup is due is when I'm not at work and HD is not connected so there is no rsnapshot run BUT the weekly timer is reset instead to be "retried" next time I reboot the machine (hopefully at work).

This is my timer configuration

[Unit]
Description=rsnapshot weekly backup

[Timer]
OnCalendar=weekly
Persistent=true
Unit=rsnapshot@weekly.service

[Install]
WantedBy=timers.target

and if I grep for a weekly run on

/var/log/messages

There is no evidence of any operation successful or not
while a daily or hourly operation is present.

If I ask for timer status

sudo systemctl status rsnapshot-weekly.timer

Oct 24 13:30:35 criniv rsnapshot[10991]: /usr/bin/rsnapshot daily: completed successfully
rsnapshot-weekly.timer - rsnapshot weekly backup
Loaded: loaded (/etc/systemd/system/rsnapshot-weekly.timer; enabled)
Active: active (waiting) since lun 2016-10-24 08:46:21 CEST; 5h 48min ago

That seems that a previous run was successful but it's not.
Can you help me to figure out how configure it correctly?

Best Answer

As suggested by Mark on timer configuration I changed OnCalendar from Unit section from

[Timer]
OnCalendar=weekly
Persistent=true
Unit=rsnapshot@weekly.service

to

[Timer]
OnCalendar=monday  *-*-* 10:00:00
Persistent=true
Unit=rsnapshot@weekly.service

This it's not exactly what I was searching for but it mitigates my problem. What I was searching for was a tweak to fix

OnCalendar=weekly

behavior that skips backup if machine is down - same problem also if I specify a date as tutorial teaches but I avoided the issue by scheduling a period I know my machine is on.