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

This commit is contained in:
Christoph 2018-12-27 19:50:39 +01:00
parent bb7ca4089b
commit 336cdb3a4d

View File

@ -754,12 +754,11 @@ stop_mysql() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Stop MySQL Service
## -
@ -829,12 +828,11 @@ stop_postgresql() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Stop PostgreSQL database service
## -
@ -927,12 +925,11 @@ stop_php_fpm() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Stop PHP-FPM Service
## -
@ -976,12 +973,11 @@ stop_php_fpm() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
for _PID in $PIDS ; do
kill -9 $_PID > /dev/null 2>&1
@ -1030,12 +1026,11 @@ stop_php_fpm() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
for _PID in $PIDS ; do
kill -9 $_PID > /dev/null 2>&1
@ -1067,12 +1062,11 @@ stop_redis() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Stop Redis Caching Service
## -
@ -1149,12 +1143,11 @@ start_mysql() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
if [[ -n "$MYSQL_INIT_SCRIPT" ]]; then
$MYSQL_INIT_SCRIPT start > /dev/null 2>&1
@ -1213,12 +1206,11 @@ start_postgresql() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Start PostgreSQL Webservice
## -
@ -1280,12 +1272,11 @@ start_apache() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Start Apache Webservice
## -
@ -1346,12 +1337,11 @@ start_nginx() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Start Nginx Webservice
## -
@ -1415,12 +1405,11 @@ start_php_fpm() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
if [[ "${start_stop_method_php_fpm[$__version]}" = "systemd_service" ]]; then
systemctl restart ${start_stop_file_php_fpm[$__version]} > /dev/null 2>&1
@ -1489,12 +1478,11 @@ start_redis() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
## - Start Redis Caching Service
## -
@ -1642,12 +1630,11 @@ graceful_restart_php_fpm() {
# - 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 '${FUNCNAME[0]}' now.."
return 1
fi
fi
if [[ "$start_stop_method_php_fpm" = "systemd_service" ]]; then
systemctl restart $start_stop_method_php_fpm["$__version"] > /dev/null 2>&1