diff --git a/.config/setup/03-install-cron-jobs.sh b/.config/setup/03-install-cron-jobs.sh index 0635fde..2ed7ab7 100755 --- a/.config/setup/03-install-cron-jobs.sh +++ b/.config/setup/03-install-cron-jobs.sh @@ -1,3 +1,3 @@ #! /usr/bin/sh -crontab ./crontab +systemctl --user enable --now backup.timer diff --git a/.config/setup/crontab b/.config/setup/crontab deleted file mode 100644 index b7dacbc..0000000 --- a/.config/setup/crontab +++ /dev/null @@ -1,2 +0,0 @@ -@hourly /home/ohad/.local/bin/make-backup -@hourly /home/ohad/.local/bin/package-alert diff --git a/.config/systemd/user/backup.service b/.config/systemd/user/backup.service new file mode 100644 index 0000000..9d3ac94 --- /dev/null +++ b/.config/systemd/user/backup.service @@ -0,0 +1,10 @@ +[Unit] +Description=Backup essential files +Wants=backup.timer + +[Service] +WorkingDirectory=%h +ExecStart=%h/.local/bin/make-backup + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/backup.timer b/.config/systemd/user/backup.timer new file mode 100644 index 0000000..7537db6 --- /dev/null +++ b/.config/systemd/user/backup.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Hourly backup job +Requires=backup.service + +[Timer] +Unit=backup.service +OnCalendar=hourly + +[Install] +WantedBy=timers.target