I want to run daily desktop backups before shutting-down for the night, which means I don’t want them to run before reboot, only before shutdown. But that’s not what’s happening:
[Unit] Description=Backup with restic at shutdown Before=poweroff.target Requires=network.target [Service] Type=oneshot TimeoutStopSec=infinity ExecStop=/usr/bin/restic backup --verbose --one-file-system --tag systemd.shutdown $BACKUP_EXCLUDES $BACKUP_PATHS ExecStopPost=/usr/bin/restic forget --verbose --tag systemd.daily --group-by paths,tags --keep-daily $RETENTION_DAYS --keep-weekly $RETENTION_WEEKS --keep-monthly $RETENTION_MONTHS --keep-yearly $RETENTION_YEARS EnvironmentFile=/etc/systemd/system/restic-backup.conf RemainAfterExit=true [Install] WantedBy=multi-user.target
correctly runs before shutting-down, but it also runs before a reboot. It shouldn’t, as I did not say:
Is this a systemD bug, since shutdown & reboot are mutually exclusive?
…or at least it seems like they should be mutually exclusive.