From d228d41c61f57f2576dd87aa7be86f9ca26e3059 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Mon, 18 Mar 2019 16:03:14 +0100 Subject: [PATCH] Squid: fix pid file issue due to new Squid version saving the PID of the parent process instead of the listener child process --- heartbeat/Squid.in | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/heartbeat/Squid.in b/heartbeat/Squid.in index a99892d75..0b3c8ea86 100644 --- a/heartbeat/Squid.in +++ b/heartbeat/Squid.in @@ -96,12 +96,9 @@ for a squid instance managed by this RA. - - -This is a required parameter. This parameter specifies a process id file -for a squid instance managed by this RA. - -Pidfile + +Deprecated - do not use anymore +deprecated - do not use anymore @@ -175,8 +172,8 @@ get_pids() # Seek by pattern SQUID_PIDS[0]=$(pgrep -f "$PROCESS_PATTERN") - # Seek by pidfile - SQUID_PIDS[1]=$(awk '1{print $1}' $SQUID_PIDFILE 2>/dev/null) + # Seek by child process + SQUID_PIDS[1]=$(pgrep -P ${SQUID_PIDS[0]}) if [[ -n "${SQUID_PIDS[1]}" ]]; then typeset exe @@ -306,7 +303,6 @@ stop_squid() while true; do get_pids if is_squid_dead; then - rm -f $SQUID_PIDFILE return $OCF_SUCCESS fi (( lapse_sec = lapse_sec + 1 )) @@ -326,7 +322,6 @@ stop_squid() kill -KILL ${SQUID_PIDS[0]} ${SQUID_PIDS[2]} sleep 1 if is_squid_dead; then - rm -f $SQUID_PIDFILE return $OCF_SUCCESS fi done @@ -389,12 +384,6 @@ if [[ ! -x "$SQUID_EXE" ]]; then exit $OCF_ERR_CONFIGURED fi -SQUID_PIDFILE="${OCF_RESKEY_squid_pidfile}" -if [[ -z "$SQUID_PIDFILE" ]]; then - ocf_exit_reason "SQUID_PIDFILE is not defined" - exit $OCF_ERR_CONFIGURED -fi - SQUID_PORT="${OCF_RESKEY_squid_port}" if [[ -z "$SQUID_PORT" ]]; then ocf_exit_reason "SQUID_PORT is not defined"