Fix bug in determin new pids.
This commit is contained in:
parent
19f7eb063e
commit
63b2fa45a8
@ -11,7 +11,7 @@ LOCK_DIR="/tmp/$(basename $0).LOCK"
|
||||
|
||||
service_name="sympa"
|
||||
alert_email_arr="ckubu@oopen.de ckubu@gmx.de"
|
||||
sender_address="check_sympa@$(hostname -f)"
|
||||
sender_address="check_${service_name}@$(hostname -f)"
|
||||
|
||||
sympa_commands="
|
||||
/usr/local/sympa/bin/sympa_msg.pl
|
||||
@ -249,12 +249,16 @@ if $restart_needed ;then
|
||||
|
||||
PIDS=""
|
||||
NEW_PIDS=""
|
||||
declare -i count_2=0
|
||||
for _command in $sympa_commands ; do
|
||||
|
||||
((count_2++))
|
||||
|
||||
PIDS="$(ps ax | grep -E "${_command}" | grep -v grep | awk '{print$1}')"
|
||||
if [[ -z "$PIDS" ]]; then
|
||||
continue
|
||||
else
|
||||
if [[ $count -eq 1 ]] ; then
|
||||
if [[ $count_2 -eq 1 ]] ; then
|
||||
NEW_PIDS="$PIDS"
|
||||
else
|
||||
NEW_PIDS="$NEW_PIDS $PIDS"
|
||||
@ -262,19 +266,23 @@ if $restart_needed ;then
|
||||
fi
|
||||
done
|
||||
restart_sucessfully=true
|
||||
break
|
||||
|
||||
done
|
||||
|
||||
if $restart_sucessfully ; then
|
||||
if ! $restart_sucessfully ; then
|
||||
error "Restarting service '${service_name}' failed."
|
||||
else
|
||||
|
||||
info "the new PIDs are $NEW_PIDS"
|
||||
info "Service '${service_name}' was restarted and is now up and running.
|
||||
The new PIDs are $NEW_PIDS"
|
||||
|
||||
if ! $terminal ; then
|
||||
echo ""
|
||||
echo "[ Success ]: Service '${service_name}' was restarted and is now up and running."
|
||||
echo " The new PIDs are $NEW_PIDS"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user