SysV init script for rpm: get and show unique PIDs only

This commit is contained in:
Denys Havrysh 2016-12-14 11:53:19 +02:00
parent 8ff68c4128
commit c94e798b8a

View file

@ -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."