packer-builds

Packer Builds for LXC and Libvirt
git clone https://git.in0rdr.ch/packer-builds.git
Log | Files | Refs | Pull requests |Archive | README

commit a7a1b52183faa251f21550278793afea374e7dcd
parent 2d177934abdcea4d68743a4c2c1b0ed0011bccb1
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Tue, 17 Dec 2024 17:44:36 +0100

feat(borg): adjust borg2 cmds and add timer

Diffstat:
Mscripts/borg-backup.sh | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/scripts/borg-backup.sh b/scripts/borg-backup.sh @@ -64,9 +64,25 @@ Description=Create a backup with borg [Service] Type=oneshot EnvironmentFile=/root/.config/borg/config -ExecStart=/usr/local/bin/borg create -v --stats --compression lz4 ::{hostname}-{now:%%Y%%m%%dT%%H%%M} --patterns-from "$PATTERNSFILE" --exclude-caches -ExecStart=/usr/local/bin/borg prune -v --list :: --prefix '{hostname}-' --keep-daily=7 --keep-weekly=4 --keep-monthly=12 +ExecStart=/usr/local/bin/borg create -v --stats --compression lz4 {hostname}-{now:%%Y%%m%%dT%%H%%M} --patterns-from "$PATTERNSFILE" --exclude-caches +ExecStart=/usr/local/bin/borg prune -v --list --match-archives '{hostname}-*' --keep-daily=7 --keep-weekly=4 --keep-monthly=12 [Install] WantedBy=default.target EOF + +# Install systemd timer +cat <<'EOF' > /etc/systemd/system/borg-backup.timer +[Unit] +Description=Create a backup with borg + +[Timer] +Unit=borg-backup.service +OnCalendar=*-*-* 11:03:00 + +[Install] +WantedBy=timers.target +EOF + +systemctl enable borg-backup.timer +systemctl start borg-backup.timer