Initial commit
This commit is contained in:
14
systemd-templates/cont-snap@.service
Normal file
14
systemd-templates/cont-snap@.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Snapshot %i container
|
||||
Requisite=systemd-nspawn@%i.service
|
||||
Wants=mnt-containers.mount
|
||||
After=systemd-nspawn@%i.service mnt-containers.mount
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/usr/bin/machinectl stop %i
|
||||
# Hereunder is a bit gross, but we need to make sure container is entirely stopped / 5 sec should be sufficient, but we have a problem with mail container; perhaps this sleep is too late anyway...
|
||||
ExecStart=/usr/bin/bash -c 'sleep 10 && /usr/bin/btrfs subvolume snapshot -r /mnt/containers/%i/current /mnt/containers/%i/$$(date +%%Y%%m%%d)'
|
||||
# As we now get random issues post snap (containers do not always restart...), we add another sleep... Real gros...
|
||||
#ExecStartPost=/usr/bin/machinectl start %i
|
||||
ExecStartPost=/usr/bin/bash -c 'sleep 10 && /usr/bin/machinectl start %i'
|
6
systemd-templates/conts-snap.service
Normal file
6
systemd-templates/conts-snap.service
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Snapshot Nspawn containers
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=PH_DIRECTORY/conts-snap.sh
|
9
systemd-templates/conts-snap.timer
Normal file
9
systemd-templates/conts-snap.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Snapshot Nspawn containers regularly
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 04:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
7
systemd-templates/docker-upgrade.service
Normal file
7
systemd-templates/docker-upgrade.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Upgrade Docker containers
|
||||
Requisite=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=PH_DIRECTORY/docker-upgrade.sh
|
9
systemd-templates/docker-upgrade.timer
Normal file
9
systemd-templates/docker-upgrade.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Upgrade Docker containers regularly
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 04:30:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
9
systemd-templates/machines-start.timer
Normal file
9
systemd-templates/machines-start.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Make sure containers are started after snapshoting
|
||||
|
||||
[Timer]
|
||||
Unit=machines.target
|
||||
OnCalendar=*-*-* 04:15:00
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user