check_sympa_service.sh: respect that the Path of the started binary could be a symlink.

This commit is contained in:
Christoph 2018-11-21 14:21:38 +01:00
parent 0154e78671
commit f08ed0d009

View File

@ -14,11 +14,11 @@ alert_email_arr="ckubu@oopen.de ckubu@gmx.de"
sender_address="check_${service_name}@$(hostname -f)"
sympa_commands="
/usr/local/sympa/bin/sympa_msg.pl
/usr/local/sympa/bin/bulk.pl
/usr/local/sympa/bin/archived.pl
/usr/local/sympa/bin/bounced.pl
/usr/local/sympa/bin/task_manager.pl
/usr/local/sympa/bin/sympa_msg.pl
/usr/local/sympa/bin/bulk.pl
/usr/local/sympa/bin/archived.pl
/usr/local/sympa/bin/bounced.pl
/usr/local/sympa/bin/task_manager.pl
"
check_string_ps="(/usr/local/sympa/bin/sympa_msg.pl|/usr/local/sympa/bin/bulk.pl|/usr/local/sympa/bin/archived.pl|/usr/local/sympa/bin/bounced.pl|/usr/local/sympa/bin/task_manager.pl)"
@ -189,11 +189,21 @@ if $terminal ; then
echo -e " ==================================="
fi
for _command in $sympa_commands ; do
# - Note:
# -
# - first we will check '/usr/local/symba/bin/<command'
# - second we will check '$(realpath "/usr/local/symba/bin/<command>"'
# - i.e /usr/local/sympa-6.2.36/bin/<command>
# -
for _command in $wwsympa_commands ; do
PIDS="$(ps ax | grep -E "${_command}" | grep -v grep | awk '{print$1}')"
if [[ -z "$PIDS" ]]; then
restart_needed=true
break
_command="$(realpath "${_command}")"
PIDS="$(ps ax | grep -E "${_command}" | grep -v grep | awk '{print$1}')"
if [[ -z "$PIDS" ]]; then
restart_needed=true
break
fi
fi
done