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