From 2956fd323f15f0d43f97ef16ab3170a2f90f1a41 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 17 Nov 2008 21:31:06 +0100 Subject: ftpsync lockfile in shell, for procmail haters Signed-off-by: Joerg Jaspert --- bin/ftpsync | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'bin/ftpsync') diff --git a/bin/ftpsync b/bin/ftpsync index 2cf4c9a..c1549c3 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -327,9 +327,18 @@ mkdir -p "${TO}/project/trace" touch "${UPDATEREQUIRED}" # Check to see if another sync is in progress -if ${LOCKFILE} -! -l 43200 -r 0 "${LOCK}"; then +if [ -x "${LOCKFILE}" ]; then + if ${LOCKFILE} -! -l 43200 -r 0 "${LOCK}"; then error "Unable to start rsync, lock file still exists" exit 1 + fi +else + if [ "`find ${LOCK} -maxdepth 1 -cmin -720`" != ""]; then + error "Unable to start rsync, lock file still exists" + exit 1 + else + touch "${LOCK}" + fi fi trap cleanup EXIT ERR TERM HUP INT QUIT -- cgit v1.2.3