Fix(Choux): borg backup from cron to systemd timer
This commit is contained in:
parent
443db2c375
commit
47ef169667
10
files/choux_borg.service
Normal file
10
files/choux_borg.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Borg Backup
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Nice=19
|
||||
IOSchedulingClass=2
|
||||
IOSchedulingPriority=7
|
||||
ExecStartPre=/usr/bin/borg break-lock {{ borg_backup_repo }}
|
||||
ExecStart={{ borg_script_path }}
|
11
files/choux_borg.timer
Normal file
11
files/choux_borg.timer
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Borg Backup Timer
|
||||
|
||||
[Timer]
|
||||
WakeSystem=false
|
||||
OnCalendar=daily
|
||||
Persistent=true
|
||||
RandomizedDelaySec=10min
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -4,14 +4,26 @@
|
||||
name: borg
|
||||
state: present
|
||||
|
||||
- name: Automate toward local RAID backup with cron.daily
|
||||
- name: Automate toward local RAID backup with systemd timer
|
||||
template:
|
||||
src: files/choux_borg_cron.sh
|
||||
dest: /etc/cron.daily/
|
||||
src: files/choux_borg.sh
|
||||
dest: {{ borg_script_path }}
|
||||
mode: 755
|
||||
|
||||
- name: Enable cronie daemon
|
||||
- name: Backup systemd timer
|
||||
template:
|
||||
src: files/choux_borg.timer
|
||||
dest: /etc/systemd/system/
|
||||
mode: 755
|
||||
|
||||
- name: Backup systemd service
|
||||
template:
|
||||
src: files/choux_borg.service
|
||||
dest: /etc/systemd/system/
|
||||
mode: 755
|
||||
|
||||
- name: Enable systemd borg script
|
||||
service:
|
||||
name: cronie
|
||||
name: choux_borg
|
||||
state: started
|
||||
enabled: yes
|
||||
|
@ -3,5 +3,6 @@
|
||||
deploy_public_key: files/id_ed25519_home.pub
|
||||
|
||||
borg_backup_repo: /media/backup/Choux
|
||||
borg_script_path: /root/.borg/backup.sh
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user