move to push backups

This commit is contained in:
Pim Kunis 2023-04-25 22:02:00 +02:00
parent 514dd7d096
commit d49257dabd
14 changed files with 326 additions and 63 deletions

View file

@ -0,0 +1,6 @@
[Unit]
Description=Backup data using Borgmatic
[Service]
ExecStart=/usr/bin/borgmatic --config /root/backup.yml
Type=oneshot

View file

@ -0,0 +1,10 @@
[Unit]
Description=Backup data daily
[Timer]
OnCalendar=*-*-* 3:00:00
Persistent=true
RandomizedDelaySec=1h
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,16 @@
location:
source_directories:
- /data
repositories:
- 'ssh://root@lewis.hyp/mnt/kingston1TB/hosts/atlas'
retention:
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
storage:
unknown_unencrypted_repo_access_is_ok: true
hooks:
before_everything:
- /root/stop_vms.sh
after_everything:
- /root/start_vms.sh

View file

@ -0,0 +1,2 @@
CertificateFile /etc/ssh/ssh_user_ed25519_key-cert.pub
IdentityFile /etc/ssh/ssh_user_ed25519_key

View file

@ -0,0 +1,3 @@
#!/bin/bash
for i in $(virsh list --all --name --autostart); do virsh start "$i"; done

View file

@ -0,0 +1,9 @@
#!/bin/bash
for i in $(virsh list --state-running --name --autostart); do
virsh shutdown "$i"
echo Stopping domain "$i"
until virsh domstate "$i" | grep shut; do
sleep 0.5
done
done