Hello,
I have created a system.d time unit to trigger a backup of my home folder but I am seeing a minor issue with it. The issue I see is that the script is being run as soon as log into my laptop and not respecting the scheduled times (weekdays at 09:00 and 15:00).
I had initially used @daily with Persistence in my .timer file, but I had seen a couple of failures with that approach (I suspect it was because the network was not ready when the script was running, thus I changed it to scheduled times).
Anyway, this is the status output showing that it ran at 08:33:38 and triggered by backup-data.timer:
$ systemctl --user status backup-data.service  ✔
â—‹ backup-data.service - A job to backup the /home folder using borg
Loaded: loaded (/home/rmoledo/.config/systemd/user/backup-data.service; enabled; vendor preset>
Active: inactive (dead) since Thu 2022-05-19 08:33:38 CEST; 15min ago
TriggeredBy: â—Ź backup-data.timer
Process: 1263 ExecStart=/usr/bin/sh /home/rmoledo/workspace/scripts/backup.sh (code=exited, sta>
Main PID: 1263 (code=exited, status=0/SUCCESS)
CPU: 8.338s
And this is the content of backup-data.timer
$ cat .config/systemd/user/backup-data.timer
[Unit]
Description=Schedule a daily backup of /home folder using borg
[Timer]
OnCalendar=Mon..Fri *-*-* 09:00:00
OnCalendar=Mon..Fri *-*-* 15:00:00
Unit=backup-data.service
[Install]
WantedBy=timers.target
I did systemctl --user daemon-reload
(and the laptop has been rebooted many times since then as well) and the timer scheduling works fine, but it still annoys me that the backup is also triggered when I log in as that should not be happening…
$ systemctl --user list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2022-05-19 09:00:00 CEST 2min 54s left n/a n/a backup-data.timer backup-data.service
1 timers listed.
Any ideas as to what the issue might be?
Thanks.