diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-06-22 07:57:50 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-06-22 07:57:50 +0300 |
commit | 92eb9c4f77daad2b0614d6b985ad4740e8996b29 (patch) | |
tree | 084fa8998db5ca5ebe5cfd85e4abff5ddd8051c9 | |
parent | c37d312f0398cac0a2eecc348bfd359e8be21ec5 (diff) | |
download | offsync-92eb9c4f77daad2b0614d6b985ad4740e8996b29.tar.gz offsync-92eb9c4f77daad2b0614d6b985ad4740e8996b29.tar.bz2 offsync-92eb9c4f77daad2b0614d6b985ad4740e8996b29.zip |
-rwxr-xr-x | start.sh | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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 |