Process: Use word-regexp to have a better match
pgrep doesn't offer such option.
This commit is contained in:
parent
f370c8d6ab
commit
4ed375c01e
|
@ -28,7 +28,7 @@ process_info() {
|
||||||
for PROCESS in ${PROCESS_LIST}; do
|
for PROCESS in ${PROCESS_LIST}; do
|
||||||
MSG="${MSG}${BLACKB}+ "
|
MSG="${MSG}${BLACKB}+ "
|
||||||
PRINTF_PROCESS=$(printf '%-22s' "${PROCESS}")
|
PRINTF_PROCESS=$(printf '%-22s' "${PROCESS}")
|
||||||
if (ps ax | grep -v grep | grep -E "${PROCESS}" > /dev/null); then
|
if (ps ax | grep --invert-match grep | grep --word-regexp "${PROCESS}" > /dev/null); then
|
||||||
MSG="${MSG}${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${GREEN}RUNNING${RESET}"
|
MSG="${MSG}${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${GREEN}RUNNING${RESET}"
|
||||||
else
|
else
|
||||||
MSG="${MSG}${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${REDB}NOT RUNNING${RESET}"
|
MSG="${MSG}${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${REDB}NOT RUNNING${RESET}"
|
||||||
|
@ -393,7 +393,7 @@ fi
|
||||||
# Process need a warning if running [[[
|
# Process need a warning if running [[[
|
||||||
YELLOW_PROCESS='tmux screen glances htop automysqlbackup vzdump puppet aptitude'
|
YELLOW_PROCESS='tmux screen glances htop automysqlbackup vzdump puppet aptitude'
|
||||||
for PROCESS in ${YELLOW_PROCESS}; do
|
for PROCESS in ${YELLOW_PROCESS}; do
|
||||||
if (ps ax | grep -v grep | grep "${PROCESS}" > /dev/null); then
|
if (ps ax | grep --invert-match grep | grep --word-regexp "${PROCESS}" > /dev/null); then
|
||||||
PRINTF_PROCESS=$(printf '%-22s' "${PROCESS}")
|
PRINTF_PROCESS=$(printf '%-22s' "${PROCESS}")
|
||||||
printf '%b' "\\n${BLACKB}+ ${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${YELLOW}RUNNING${RESET}"
|
printf '%b' "\\n${BLACKB}+ ${WHITE}${PRINTF_PROCESS}${RESET}${BLACKB}= ${YELLOW}RUNNING${RESET}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue