check_postfix.sh: fix error if distribution is not Debian or Ubuntu.

This commit is contained in:
Christoph 2018-12-27 19:36:16 +01:00
parent 3036be6061
commit bb7ca4089b

View File

@ -181,8 +181,8 @@ if ! ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep -v grep > /dev/n
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
# -
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
warn "It seems that package management (apt,dpkg) is running. Exiting restarting the service .."
else
$systemctl stop postfix > /dev/null 2> ${LOCK_DIR}/err_msg.log
@ -194,8 +194,8 @@ if ! ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep -v grep > /dev/n
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
# -
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
warn "It seems that package management (apt,dpkg) is running. Omit starting the service .."
else
$systemctl start postfix > /dev/null 2> ${LOCK_DIR}/err_msg.log
@ -204,15 +204,13 @@ if ! ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep -v grep > /dev/n
fi
fi
fi
fi
fi
else
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
# -
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
warn "It seems that package management (apt,dpkg) is running - Exiting restarting the service .."
else
$postfix_init_script stop > /dev/null 2>&1
@ -224,8 +222,8 @@ if ! ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep -v grep > /dev/n
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
# -
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
warn "It seems that package management (apt,dpkg) is running. Omit starting the service .."
else
$postfix_init_script start > /dev/null 2>&1
@ -233,10 +231,8 @@ if ! ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep -v grep > /dev/n
error "Starting Postfix Mailservice failed!"
fi
fi
fi
fi
fi
fi