From 891717e7bbb56e3400f05d32ac5d0be90ee4cacb Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Tue, 18 Nov 2008 23:07:02 +0100 Subject: more lockfile fun Signed-off-by: Joerg Jaspert --- bin/ftpsync | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin/ftpsync') 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 -- cgit v1.2.3