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