From 8ff68c4128218ea29034cada381fec9e235eda2a Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 29 Nov 2016 16:23:48 +0200 Subject: [PATCH 1/2] Fix initscript for RHEL5 (SysV) to pick up proper python version --- pkg/rpm/salt-minion | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/rpm/salt-minion b/pkg/rpm/salt-minion index 1bf308aadb..ed99dfd0c5 100755 --- a/pkg/rpm/salt-minion +++ b/pkg/rpm/salt-minion @@ -25,12 +25,11 @@ # processname: /usr/bin/salt-minion # Allow these to be overridden for tests -: ${SALTMINION_BINDIR:=/usr/bin} -: ${SALTMINION_SYSCONFDIR:=/etc} -: ${SALTMINION_PYTHON:=python} # Python must be 2.6 or newer +: "${SALTMINION_BINDIR:=/usr/bin}" +: "${SALTMINION_SYSCONFDIR:=/etc}" # Default values (can be overridden in settings file) -: ${USER:=$(id -nu)} +: "${USER:=$(id -nu)}" SALTMINION="${SALTMINION_BINDIR}/salt-minion" SALTCALL="${SALTMINION_BINDIR}/salt-call" # SALTMINION_CONFIGS are newline-separated entries of: MINION_USER CONFIG_DIR @@ -42,7 +41,6 @@ SALTMINION_TIMEOUT=30 SALTMINION_TICK=1 SERVICE="salt-minion" -PROCESS="salt-minion" # Read in settings file if [ -f "${SALTMINION_SYSCONFDIR}/default/salt" ]; then @@ -82,7 +80,7 @@ _is_running() { _get_salt_config_value() { _su_cmd \ "$MINION_USER" \ - "\"$SALTMINION_PYTHON\" \ + "\ \"$SALTCALL\" \ -c \"$CONFIG_DIR\" \ --no-color \ @@ -127,7 +125,7 @@ start() { _su_cmd \ "$MINION_USER" \ - "\"$SALTMINION_PYTHON\" \ + "\ \"$SALTMINION\" \ -c \"$CONFIG_DIR\" \ -d $SALTMINION_ARGS \ From c94e798b8a7605c0491005811968d355afd51d42 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 14 Dec 2016 11:53:19 +0200 Subject: [PATCH 2/2] SysV init script for rpm: get and show unique PIDs only --- pkg/rpm/salt-minion | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/rpm/salt-minion b/pkg/rpm/salt-minion index ed99dfd0c5..06d5f0bf7d 100755 --- a/pkg/rpm/salt-minion +++ b/pkg/rpm/salt-minion @@ -33,9 +33,9 @@ SALTMINION="${SALTMINION_BINDIR}/salt-minion" SALTCALL="${SALTMINION_BINDIR}/salt-call" # SALTMINION_CONFIGS are newline-separated entries of: MINION_USER CONFIG_DIR -: ${SALTMINION_CONFIGS:=" +: "${SALTMINION_CONFIGS:=" $USER ${SALTMINION_SYSCONFDIR}/salt -"} +"}" SALTMINION_ARGS="" SALTMINION_TIMEOUT=30 SALTMINION_TICK=1 @@ -68,7 +68,8 @@ _su_cmd() { _get_pid() { netstat $NS_NOTRIM -ap --protocol=unix 2>$ERROR_TO_DEVNULL \ - | sed -r -e "\|\s${SOCK_DIR}/minion_event_${MINION_ID_HASH}_pub\.ipc$|"'!d; s|/.*||; s/.*\s//;' + | sed -r -e "\|\s${SOCK_DIR}/minion_event_${MINION_ID_HASH}_pub\.ipc$|"'!d; s|/.*||; s/.*\s//;' \ + | uniq } @@ -218,7 +219,8 @@ status() { local pid="$(_get_pid)" if [ -n "$pid" ]; then - echo "$SERVICE:$MINION_USER:$MINION_ID is running: $pid" + # Unquote $pid here to display multiple PIDs in one line + echo "$SERVICE:$MINION_USER:$MINION_ID is running:" $pid else retval=3 echo "$SERVICE:$MINION_USER:$MINION_ID is stopped."