add systemd timer to run daily backups

This commit is contained in:
Matthew Saunders Brown 2022-03-28 08:11:40 -07:00
parent 0580a2edf2
commit e9e27f1f34
11 changed files with 39 additions and 0 deletions

14
sbin/bashup-cron.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# Bashup - A set of bash scripts for managing backups.
# https://git.stack-source.com/msb/bashup
# MIT License Copyright (c) 2022 Matthew Saunders Brown
# load include file
source /usr/local/sbin/bashup.sh
for job in "${bashup_jobs[@]}"; do
if [[ -x /usr/local/sbin/bashup-backup-$job.sh ]]; then
/usr/local/sbin/bashup-backup-$job.sh
fi
done

View File

@ -0,0 +1,10 @@
# Bashup - A set of bash scripts for managing backups.
# https://git.stack-source.com/msb/bashup
# MIT License Copyright (c) 2022 Matthew Saunders Brown
#
[Unit]
Description=Bashup cron for automatic backups
[Service]
Type=simple
ExecStart=/usr/local/sbin/bashup-cron.sh

15
systemd/bashup-cron.timer Normal file
View File

@ -0,0 +1,15 @@
# Bashup - A set of bash scripts for managing backups.
# https://git.stack-source.com/msb/bashup
# MIT License Copyright (c) 2022 Matthew Saunders Brown
#
[Unit]
Description=Bashup cron for automatic backups
[Timer]
# Run daily between 3-5 am
OnCalendar=*-*-* 03:00:00
RandomizedDelaySec=7200
Unit=bashup-cron.service
[Install]
WantedBy=timers.target