diff options
author | Joerg Jaspert <joerg@debian.org> | 2008-11-18 22:22:08 +0100 |
---|---|---|
committer | Joerg Jaspert <joerg@debian.org> | 2008-11-18 22:22:08 +0100 |
commit | 02c33932c60b13ef5c5a0a201ca1386bc2a7733d (patch) | |
tree | c32709739bce709633fccc0195cbfc4945541e84 | |
parent | 23d1853b550c216f77d0d30601e5d83f3744483c (diff) |
ftpsync
kick lockfile, use shell only
Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-x | bin/ftpsync | 16 | ||||
-rw-r--r-- | etc/ftpsync.conf.sample | 6 |
2 files changed, 3 insertions, 19 deletions
diff --git a/bin/ftpsync b/bin/ftpsync index 202bb02..e98cdf5 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -235,8 +235,6 @@ FULLLOGS=${FULLLOGS:-"false"} # How to rotate our log SAVELOG=${SAVELOG:-"savelog -t -c 14"} -# Lockfile program -LOCKFILE=${LOCKFILE:-"lockfile"} # Our lockfile LOCK=${LOCK:-"${TO}/Archive-Update-in-Progress-${MIRRORNAME}"} @@ -327,19 +325,11 @@ mkdir -p "${TO}/project/trace" touch "${UPDATEREQUIRED}" # Check to see if another sync is in progress -if [ -x "${LOCKFILE}" ]; then - if ${LOCKFILE} -! -l 43200 -r 0 "${LOCK}"; then - error "Unable to start rsync, lock file still exists" +if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then + error "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})" 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 # Start log by redirecting everything there. diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample index 8f6a130..b1e8dc8 100644 --- a/etc/ftpsync.conf.sample +++ b/etc/ftpsync.conf.sample @@ -75,12 +75,6 @@ ## defines how. #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) #LOCK="${TO}/Archive-Update-in-Progress-${MIRRORNAME}" |