Fix to assure only one instance is running.
Since this script runs under /usr/bin/env, running 'pgrep $0' will fail due to it being a child of 'bash'. In order to fix this, pgrep must use the `-o` flag (oldest pid, or in this case, the leader), and `-f` which searches the full process name.
This commit is contained in:
+1
-1
@@ -307,7 +307,7 @@ if [ -n "$(fn_find "$INPROGRESS_FILE")" ]; then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")"
|
RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")"
|
||||||
if [ "$RUNNINGPID" = "$(pgrep "$APPNAME")" ]; then
|
if [ "$RUNNINGPID" = "$(pgrep -o -f "$APPNAME")" ]; then
|
||||||
fn_log_error "Previous backup task is still active - aborting."
|
fn_log_error "Previous backup task is still active - aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user