diff options
author | Joerg Jaspert <joerg@debian.org> | 2008-11-18 23:07:02 +0100 |
---|---|---|
committer | Joerg Jaspert <joerg@debian.org> | 2008-11-18 23:07:02 +0100 |
commit | 891717e7bbb56e3400f05d32ac5d0be90ee4cacb (patch) | |
tree | 8e7e78153e00449c802037473676dd6bd416c806 /bin/ftpsync | |
parent | 02c33932c60b13ef5c5a0a201ca1386bc2a7733d (diff) |
more lockfile fun
Signed-off-by: Joerg Jaspert <joerg@debian.org>
Diffstat (limited to 'bin/ftpsync')
-rwxr-xr-x | bin/ftpsync | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/ftpsync b/bin/ftpsync index e98cdf5..7958ae7 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -326,8 +326,13 @@ touch "${UPDATEREQUIRED}" # Check to see if another sync is in progress if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then - error "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})" - exit 1 + if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then + # Process does either not exist or is not owned by us. + echo "$$" > "${LOCK}" + else + echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})" + exit 1 + fi fi trap cleanup EXIT ERR TERM HUP INT QUIT |