Skip to content

Commit

Permalink
Merge pull request #1498 from hir-nito/v1.4.9
Browse files Browse the repository at this point in the history
Prevent duplicate execution of proxysql_galera_checker.sh
  • Loading branch information
Nick Vyzas authored May 30, 2018
2 parents 5223624 + 986958a commit d9fd599
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/proxysql_galera_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ WRITER_IS_READER="${4:-1}"
ERR_FILE="${5:-/dev/null}"
RELOAD_CHECK_FILE="/var/lib/proxysql/reload"

# Prevent duplicate execution
BASENAME=`basename "$0"`
pidof -x -o %PPID ${BASENAME}
ANOTHER_PROCESS_IS_RUNNING=$?
if [ ${ANOTHER_PROCESS_IS_RUNNING} -eq 0 ]; then
echo "`date` ###### Another process is already running. Abort! ######" >> ${ERR_FILE}
exit 0
fi

echo "0" > ${RELOAD_CHECK_FILE}

if [ "$1" = '-h' -o "$1" = '--help' -o -z "$1" ]
Expand Down

0 comments on commit d9fd599

Please sign in to comment.