From 787578c3554ff10ff4cc1293fd0ee76961460dbb Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 19 Dec 2024 05:14:39 +0100 Subject: [PATCH] Update btrfs-backup script. Add lock file generation --- nixos/common/software/cli/scripts/btrfs-backup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos/common/software/cli/scripts/btrfs-backup.sh b/nixos/common/software/cli/scripts/btrfs-backup.sh index 33a4dcfd..a07a90a2 100755 --- a/nixos/common/software/cli/scripts/btrfs-backup.sh +++ b/nixos/common/software/cli/scripts/btrfs-backup.sh @@ -53,8 +53,7 @@ create_lock() { fi # Create new lock file with current PID - sudo touch "$LOCK_FILE" - sudo echo $$ > "$LOCK_FILE" + sudo echo $$ | sudo tee "$LOCK_FILE" # Ensure lock file is removed on script exit trap cleanup_lock EXIT