[Unit] Description=Sync logs to disk before shutdown DefaultDependencies=false Before=shutdown.target reboot.target halt.target Conflicts=shutdown.target reboot.target halt.target [Service] Type=oneshot RemainAfterExit=true ExecStart=/bin/sh -c 'rsync -aXv --delete --exclude="*.hdd" /var/log/ /var/log.hdd/ 2>/dev/null || true' TimeoutStopSec=30 [Install] WantedBy=shutdown.target reboot.target halt.target