summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/borg-backup.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/config/borg-backup.nix b/config/borg-backup.nix
index 5b45358..3a6fd7b 100644
--- a/config/borg-backup.nix
+++ b/config/borg-backup.nix
@@ -56,13 +56,20 @@ in
systemd.services.backup-prober = {
description = "Find latest backup probe timestamp.";
- path = with pkgs; [ borgbackup rsync openssh moreutils ];
+ path = with pkgs; [ borgbackup rsync openssh sshfs moreutils ];
startAt = "06:30";
+ serviceConfig = {
+ RuntimeDirectory = "backup-prober";
+ };
environment = {
- BORG_KEYS_DIR = "/opt/secret/borg-backup-keys/";
- REPOSITORY = repo;
+ BORG_KEY_FILE = "/opt/secret/borg-backup-keys/staging_backup";
+ BORG_RELOCATED_REPO_ACCESS_IS_OK = "yes";
};
script = ''
+ mkdir "$RUNTIME_DIRECTORY/mnt"
+ sshfs root@orbekk.osl.trygveandre.net:/storage "$RUNTIME_DIRECTORY/mnt"
+ REPOSITORY="$RUNTIME_DIRECTORY/backup"
+
last_repo="$(borg list $REPOSITORY -P ${probe.repo} --last 1 --short)"
target="${config.orbekk.monitoring-server.textFileDir}/backup_probe.prom"
timestamp=$(borg extract --stdout $REPOSITORY::"$last_repo" "${probe.repo_path}")