From 2f64db5973b5f1b13221d391076967b5a55dbb7a Mon Sep 17 00:00:00 2001 From: uglygus Date: Sat, 4 Apr 2015 07:50:11 -0400 Subject: [PATCH] PID reuse Checks for PID and $APPNAME in the results from pgrep in order to avoid the problem where the PID from a previous run has been recycled by another process. This caused us to exit even though we are not currently running. --- rsync_tmbackup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 553dcd6..0105ee1 100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -113,7 +113,7 @@ fi # ----------------------------------------------------------------------------- if [ -f "$INPROGRESS_FILE" ]; then - if pgrep -F "$INPROGRESS_FILE" > /dev/null 2>&1 ; then + if pgrep -F "$INPROGRESS_FILE" "$APPNAME"> /dev/null 2>&1 ; then fn_log_error "Previous backup task is still active - aborting." exit 1 fi