From 92eb9c4f77daad2b0614d6b985ad4740e8996b29 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 22 Jun 2010 07:57:50 +0300 Subject: pidfile check in start.sh --- start.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 351474b..e6abfa3 100755 --- a/start.sh +++ b/start.sh @@ -10,6 +10,11 @@ if -z "${RSYNC_TARGET}"; then exit 1 fi +if [[ -e "$PIDFILE" ]]; then + echo "Offsync already running, exiting" 2>&1 + exit 1 +fi + date >> "${LOGFILE}" /usr/local/bin/rsync -auvhNHXxrz\ --stats --protect-args --fileflags --force-change --delete\ @@ -20,6 +25,10 @@ echo $! > "$PIDFILE" # wait for rsync to finish wait $(cat "$PIDFILE") -rm "$PIDFILE" + +# stop may have already deleted it +if [[ -e "$PIDFILE" ]]; then + rm "$PIDFILE" +fi tail "$LOGFILE" | mail -E -s "Offsite backup of $(hostname) completed" $MAILTO -- cgit v1.2.3