summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2008-11-17 21:31:06 +0100
committerJoerg Jaspert <joerg@debian.org>2008-11-17 21:31:06 +0100
commit2956fd323f15f0d43f97ef16ab3170a2f90f1a41 (patch)
tree0ef499b27c13dea7e5972a557d1f0294bcbe5d70
parent8bebb76167fba66c03feb36b66c10cad5ccf98f0 (diff)
ftpsync
lockfile in shell, for procmail haters Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/ftpsync11
-rw-r--r--etc/ftpsync.conf.sample3
2 files changed, 13 insertions, 1 deletions
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
diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample
index 14563e9..8f6a130 100644
--- a/etc/ftpsync.conf.sample
+++ b/etc/ftpsync.conf.sample
@@ -76,6 +76,9 @@
#SAVELOG="savelog -t -c 14"
## We need to deal with lockfiles
+## If this is not set *AND* lockfile (from procmail package) is not found, we fall
+## back to a method using find. That is less safe, but still works, in case you don't
+## want to install procmail.
#LOCKFILE="lockfile"
## Our own lockfile (only one sync should run at any time)