mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-25 22:35:03 +01:00
yodaHedgehog: backup service
This commit is contained in:
parent
92167da3a2
commit
0e662cc053
@ -48,17 +48,26 @@ in
|
||||
path = with pkgs; [
|
||||
# Provides `ssh`
|
||||
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
|
||||
# Provides `smtpctl`
|
||||
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 = ''
|
||||
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.
|
||||
while :; do
|
||||
@ -105,7 +114,7 @@ in
|
||||
#done
|
||||
sleep 15s
|
||||
|
||||
printf '%s\n' 'Finished backup script.'
|
||||
#printf '%s\n' 'Finished backup script.'
|
||||
# Suspend to save power.
|
||||
systemctl suspend
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user