From 7934ea89ee49fb8db33eb4e6da9d20aa93df84a1 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 19 Dec 2024 05:16:38 +0100 Subject: [PATCH] Update btrfs-backup script. Add lock file generation --- nixos/common/software/cli/scripts/btrfs-backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/common/software/cli/scripts/btrfs-backup.sh b/nixos/common/software/cli/scripts/btrfs-backup.sh index a07a90a2..f1db9735 100755 --- a/nixos/common/software/cli/scripts/btrfs-backup.sh +++ b/nixos/common/software/cli/scripts/btrfs-backup.sh @@ -37,7 +37,7 @@ LOCK_FILE="/var/run/btrfs-backup-${1}.lock" # Lock file creation with cleanup cleanup_lock() { - rm -f "$LOCK_FILE" + sudo rm -f "$LOCK_FILE" } create_lock() { @@ -48,7 +48,7 @@ create_lock() { exit 1 else # Lock file exists but process is not running, remove stale lock - rm -f "$LOCK_FILE" + cleanup_lock fi fi