config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 9320103eba3305bd9e1f3ef414995b730cf196c6
parent f0c0f7fc659e9542a0feb5cc7b38e504943f6515
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Tue, 29 Oct 2024 13:04:02 -0700

Fix backupserver script

1. Use of incorrect variable name caused nothing to ever be saved
2. Mix-match of current working directory and the backup directory
   caused unexpected behavior

Diffstat:
Mlocal/bin/bin/backupserver | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/local/bin/bin/backupserver b/local/bin/bin/backupserver @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 Jacob R. Edwards +# Copyright 2023, 2024 Jacob R. Edwards # Keep a set of backups of a server (which has srvbackup installed) # # This works like newsyslog(8), shifting each backup until a certain @@ -15,6 +15,8 @@ server="${login##*@}" backup="$server".tar tmp="$(mktemp "$backups"/tmp-XXXXXX)" +cd "$backups" + trap 'rm -f "$tmp"' 0 TERM INT if test -f "$backup" @@ -24,7 +26,7 @@ fi ssh -C "$login" /usr/local/bin/srvbackup get $sha > "$tmp" || exit 1 -! test -s "$t" && +! test -s "$tmp" && exit 0 for num in 6 5 4 3 2 1 0