I try to create a timer unit for weekly and daily backups. For example with the weekly unit, it should be executed once in a week, some minutes after login. If the unit was successful, it should shutdown and not start again until the next week. If a start of this unit was missing, it should be start again some minutes after the next login.
But for some unknown reason, the current unit starts after every login when I reboot the laptop. I am relatively sure that this timer unit is set up wrong, but unfortunately I don’t know how I can implement such a unit better with the functions mentioned above.
[Unit]
Description=Run backup weekly
Requires=backup.service
[Timer]
Unit=backup.service
OnCalendar=weekly
RandomizedDelaySec=120
Persistent=true
[Install]
WantedBy=timers.target
You have the timer requiring backup.service, so it will run that service every time the timer starts on boot. Remove
Requires=backup.service
, and that will fix the issue.