mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-22 22:09:34 +01:00
yodaHedgehog: backup service
This commit is contained in:
parent
92167da3a2
commit
0e662cc053
@ -48,17 +48,26 @@ in
|
|||||||
path = with pkgs; [
|
path = with pkgs; [
|
||||||
# Provides `ssh`
|
# Provides `ssh`
|
||||||
openssh
|
openssh
|
||||||
# Provides `awk`, `grep`, `sleep`, `printf`, `echo`, 'sendmail'
|
# Provides `readlink` (with support for parameter `-e`, required by `btrbk`)
|
||||||
|
coreutils
|
||||||
|
# Provides `awk`, `grep`, `sleep`, `printf`, `echo`, 'sendmail', `readlink` (without support for parameter `-e`)
|
||||||
busybox
|
busybox
|
||||||
# Provides `smtpctl`
|
# Provides `smtpctl`
|
||||||
opensmtpd
|
opensmtpd
|
||||||
|
# Provides `btrbk`
|
||||||
|
btrbk
|
||||||
|
# Provides `sudo` required by `btrbk`.
|
||||||
|
# Alternatively we could configure `btrbk` to use the "btrfs-progs" instead of the "btrfs-progs-sudo" backend. But the `btrbk` NixOS module has no option for this.
|
||||||
|
sudo
|
||||||
];
|
];
|
||||||
# Script to execute as main process.
|
# Script to execute as main process.
|
||||||
script = ''
|
script = ''
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
printf '%s\n' 'Starting backup script.'
|
#printf '%s\n' 'Starting backup script.'
|
||||||
|
|
||||||
# TODO: Backup: Pull BTRFS snapshots from ${backup-source}.
|
# Pull BTRFS snapshots from ${backup-source}.
|
||||||
|
btrbk -c /etc/btrbk/remote-backup-ssd.conf run
|
||||||
|
btrbk -c /etc/btrbk/remote-backup-hdd.conf run
|
||||||
|
|
||||||
# Don't suspend as long as `${backup-source}:${stay-awake-file}` exists.
|
# Don't suspend as long as `${backup-source}:${stay-awake-file}` exists.
|
||||||
while :; do
|
while :; do
|
||||||
@ -105,7 +114,7 @@ in
|
|||||||
#done
|
#done
|
||||||
sleep 15s
|
sleep 15s
|
||||||
|
|
||||||
printf '%s\n' 'Finished backup script.'
|
#printf '%s\n' 'Finished backup script.'
|
||||||
# Suspend to save power.
|
# Suspend to save power.
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user