From 8f351ae4d14fc2abcc83716a192dfacff6dc65ef Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 01:37:41 -0400 Subject: feat: lock backups internally so cron needs no flock wrapper rsyncshot now acquires an exclusive, non-blocking lock (fd 200) before the backup phase, so a slow backup can't overlap the next cron tick. Only real backups lock. Help, list, status, and dryrun don't, so they're never blocked. The lock file defaults to /run/lock/rsyncshot.lock, a root-only directory that avoids the symlink-truncation risk of a predictable name in world-writable /tmp. It falls back to /var/lock then /tmp, and is configurable via LOCKFILE. It's deliberately a different file from the old /tmp/rsyncshot.lock cron wrappers, so existing wrapped crontabs keep working until the wrapper is removed. setup() no longer wraps cron entries in flock, since the script locks itself. --- tests/test_rsyncshot.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test_rsyncshot.sh') diff --git a/tests/test_rsyncshot.sh b/tests/test_rsyncshot.sh index 95a0032..857dd95 100755 --- a/tests/test_rsyncshot.sh +++ b/tests/test_rsyncshot.sh @@ -95,6 +95,7 @@ run_test_file "$SCRIPT_DIR/cases/test_functions.sh" "functions" run_test_file "$SCRIPT_DIR/cases/test_includes.sh" "includes" run_test_file "$SCRIPT_DIR/cases/test_dryrun.sh" "dryrun" run_test_file "$SCRIPT_DIR/cases/test_rsync_flags.sh" "rsync_flags" +run_test_file "$SCRIPT_DIR/cases/test_locking.sh" "locking" if [ "$QUICK" = false ]; then run_test_file "$SCRIPT_DIR/cases/test_backup.sh" "backup" -- cgit v1.2.3