check_webservice_load.sh: fix error if distribution is not Debian or Ubuntu.
This commit is contained in:
parent
bb7ca4089b
commit
336cdb3a4d
@ -754,12 +754,11 @@ stop_mysql() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Stop MySQL Service
|
## - Stop MySQL Service
|
||||||
## -
|
## -
|
||||||
@ -829,12 +828,11 @@ stop_postgresql() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Stop PostgreSQL database service
|
## - Stop PostgreSQL database service
|
||||||
## -
|
## -
|
||||||
@ -927,12 +925,11 @@ stop_php_fpm() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Stop PHP-FPM Service
|
## - Stop PHP-FPM Service
|
||||||
## -
|
## -
|
||||||
@ -976,12 +973,11 @@ stop_php_fpm() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
for _PID in $PIDS ; do
|
for _PID in $PIDS ; do
|
||||||
kill -9 $_PID > /dev/null 2>&1
|
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)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
for _PID in $PIDS ; do
|
for _PID in $PIDS ; do
|
||||||
kill -9 $_PID > /dev/null 2>&1
|
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)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Stop Redis Caching Service
|
## - Stop Redis Caching Service
|
||||||
## -
|
## -
|
||||||
@ -1149,12 +1143,11 @@ start_mysql() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$MYSQL_INIT_SCRIPT" ]]; then
|
if [[ -n "$MYSQL_INIT_SCRIPT" ]]; then
|
||||||
$MYSQL_INIT_SCRIPT start > /dev/null 2>&1
|
$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)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Start PostgreSQL Webservice
|
## - Start PostgreSQL Webservice
|
||||||
## -
|
## -
|
||||||
@ -1280,12 +1272,11 @@ start_apache() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Start Apache Webservice
|
## - Start Apache Webservice
|
||||||
## -
|
## -
|
||||||
@ -1346,12 +1337,11 @@ start_nginx() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Start Nginx Webservice
|
## - Start Nginx Webservice
|
||||||
## -
|
## -
|
||||||
@ -1415,12 +1405,11 @@ start_php_fpm() {
|
|||||||
|
|
||||||
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${start_stop_method_php_fpm[$__version]}" = "systemd_service" ]]; then
|
if [[ "${start_stop_method_php_fpm[$__version]}" = "systemd_service" ]]; then
|
||||||
systemctl restart ${start_stop_file_php_fpm[$__version]} > /dev/null 2>&1
|
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)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## - Start Redis Caching Service
|
## - 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)
|
# - Don't Start/Stop Services if package management is running (apt,aptitude,dpkg)
|
||||||
# -
|
# -
|
||||||
if [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ; then
|
if ( [[ "${os_dist,,}" = "debian" ]] || [[ "${os_dist,,}" = "ubuntu" ]] ) \
|
||||||
if $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
&& $(lsof /var/lib/dpkg/lock >/dev/null 2>&1) ; then
|
||||||
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
warn "It seems that package management (apt,dpkg) is running. Exiting '${FUNCNAME[0]}' now.."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$start_stop_method_php_fpm" = "systemd_service" ]]; then
|
if [[ "$start_stop_method_php_fpm" = "systemd_service" ]]; then
|
||||||
systemctl restart $start_stop_method_php_fpm["$__version"] > /dev/null 2>&1
|
systemctl restart $start_stop_method_php_fpm["$__version"] > /dev/null 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user