Update btrfs-backup script. Add lock file generation

This commit is contained in:
albert 2024-12-19 05:16:38 +01:00
parent 787578c355
commit 7934ea89ee
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -37,7 +37,7 @@ LOCK_FILE="/var/run/btrfs-backup-${1}.lock"
# Lock file creation with cleanup # Lock file creation with cleanup
cleanup_lock() { cleanup_lock() {
rm -f "$LOCK_FILE" sudo rm -f "$LOCK_FILE"
} }
create_lock() { create_lock() {
@ -48,7 +48,7 @@ create_lock() {
exit 1 exit 1
else else
# Lock file exists but process is not running, remove stale lock # Lock file exists but process is not running, remove stale lock
rm -f "$LOCK_FILE" cleanup_lock
fi fi
fi fi