fix Workspace backup

This commit is contained in:
Thomas Avé 2025-07-29 14:10:08 +02:00
parent 69b8ea5cd2
commit ce056f79ff
3 changed files with 25 additions and 31 deletions

View File

@ -23,30 +23,30 @@ let
${pkgs.notmuch}/bin/notmuch new ${pkgs.notmuch}/bin/notmuch new
''); '');
}; };
sync_vault = { # sync_vault = {
when = "*-*-* 02:00:00"; # when = "*-*-* 02:00:00";
script = toString (pkgs.writeShellScript "script" '' # script = toString (pkgs.writeShellScript "script" ''
source $HOME/.secrets/Backup/env.sh # source $HOME/.secrets/Backup/env.sh
for _ in {1..2}; do # for _ in {1..2}; do
OUTPUT=$(echo "$ZFS_PASSPHRASE" | ssh 10.4.0.1 zfs load-key Vault/Thomas/Encrypted 2>&1); # OUTPUT=$(echo "$ZFS_PASSPHRASE" | ssh 10.4.0.1 zfs load-key Vault/Thomas/Encrypted 2>&1);
if [ "$OUTPUT" == "Key load error: Key already loaded for 'Vault/Thomas/Encrypted'." ]; then # if [ "$OUTPUT" == "Key load error: Key already loaded for 'Vault/Thomas/Encrypted'." ]; then
echo "Key successfully loaded, starting syncoid" # echo "Key successfully loaded, starting syncoid"
syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Thomas/Workspace 10.4.0.1:Vault/Thomas/Encrypted/Storage/Workspace # syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Thomas/Workspace 10.4.0.1:Vault/Thomas/Encrypted/Storage/Workspace
syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Thomas 10.4.0.1:Vault/Thomas/Encrypted/Storage/T # syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Thomas 10.4.0.1:Vault/Thomas/Encrypted/Storage/T
syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Emily 10.4.0.1:Vault/Thomas/Encrypted/Storage/N # syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Emily 10.4.0.1:Vault/Thomas/Encrypted/Storage/N
syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Yolande 10.4.0.1:Vault/Thomas/Encrypted/Storage/Y # syncoid --no-privilege-elevation --no-sync-snap tank/Storage/Yolande 10.4.0.1:Vault/Thomas/Encrypted/Storage/Y
syncoid --no-privilege-elevation --no-sync-snap tank/Containers 10.4.0.1:Vault/Thomas/Encrypted/Containers # syncoid --no-privilege-elevation --no-sync-snap tank/Containers 10.4.0.1:Vault/Thomas/Encrypted/Containers
ssh 10.4.0.1 zfs unload-key Vault/Thomas/Encrypted # ssh 10.4.0.1 zfs unload-key Vault/Thomas/Encrypted
${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/s39pIIrB0R # ${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/s39pIIrB0R
exit 0 # exit 0
fi # fi
done # done
#
echo "Found output instead: $OUTPUT" # echo "Found output instead: $OUTPUT"
echo "Failed to load key: $OUTPUT" | sendmail # echo "Failed to load key: $OUTPUT" | sendmail
exit 1 # exit 1
''); # '');
}; # };
backup = { backup = {
when = "*-*-* 04:00:00"; when = "*-*-* 04:00:00";
script = toString (pkgs.writeShellScript "script" '' script = toString (pkgs.writeShellScript "script" ''

View File

@ -93,8 +93,8 @@ borg create -s --progress \
echo -e '\n\n\n' echo -e '\n\n\n'
echo "Running Workspace Backups" echo "Running Workspace Backups"
borg create -s --progress \ borg create -s --progress \
10.4.0.1:Storage/Thomas/Borg/Workspace::'{hostname}-{now}' \
--exclude /home/server/Workspace/TrackBox/Resources \ --exclude /home/server/Workspace/TrackBox/Resources \
10.4.0.1:Storage/Thomas/Borg/Workspace::'{hostname}-{now}' \
/home/server/Workspace/ /home/server/Workspace/
borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly -1 --save-space 10.4.0.1:Storage/Thomas/Borg/Workspace borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly -1 --save-space 10.4.0.1:Storage/Thomas/Borg/Workspace
borg compact 10.4.0.1:Storage/Thomas/Borg/Workspace borg compact 10.4.0.1:Storage/Thomas/Borg/Workspace

View File

@ -25,12 +25,6 @@
gocryptfs gocryptfs
sshfs sshfs
]; ];
programs.nh = {
enable = true;
clean.enable = true;
flake = "/home/user/.dotfiles";
};
home.sessionVariables = { home.sessionVariables = {
XDG_CONFIG_HOME = "${config.xdg.configHome}"; XDG_CONFIG_HOME = "${config.xdg.configHome}";
XDG_CACHE_HOME = "${config.xdg.cacheHome}"; XDG_CACHE_HOME = "${config.xdg.cacheHome}";