update_nextcloud.sh: adjust to match new data directory 'date' - befor it was a symlink to 'data-<version>'.
This commit is contained in:
parent
9400038bbe
commit
b2f47c8633
@ -343,7 +343,7 @@ echo ""
|
||||
|
||||
DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
#DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
|
||||
if [[ -z ${WEBSITE} ]] ; then
|
||||
@ -354,8 +354,7 @@ DEFAULT_WEB_BASE_DIR="/var/www/$WEBSITE"
|
||||
DEFAULT_PHP_ENGINE="FPM"
|
||||
|
||||
[[ -n "$SRC_BASE_DIR" ]] || SRC_BASE_DIR=$DEFAULT_SRC_BASE_DIR
|
||||
#[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
#[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
|
||||
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
|
||||
|
||||
if [[ ! -d ${WEB_BASE_DIR} ]] ; then
|
||||
@ -382,78 +381,89 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
#
|
||||
if $(systemctl -q is-active nginx) ; then
|
||||
NGINX_IS_ACTIVE=true
|
||||
else
|
||||
NGINX_IS_ACTIVE=false
|
||||
fi
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
|
||||
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
|
||||
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
|
||||
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
PHP_VERSION="$(grep -o -E "php-?.{1}\..{1}-fpm" $VHOST_CONFIG_FILE | grep -o -E ".{1}\..{1}")"
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
fatal "PHP Version must be givven if running PHP-FPM engine (parameter 'PHP_VERSION')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# - Determin PHP binary
|
||||
# -
|
||||
php_binary="$(realpath "$(which php)")"
|
||||
if [[ -z "$php_binary" ]]; then
|
||||
if [[ -x "/usr/local/php/bin/php" ]]; then
|
||||
php_binary="/usr/local/php/bin/php"
|
||||
else
|
||||
fatal "No PHP binary present"
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
else
|
||||
if [[ ! -x "$php_binary" ]]; then
|
||||
fatal "Found PHP binary '$php_binary', but this file is not executable!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# - Determin user/group of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
@ -463,6 +473,7 @@ if [[ -n "$_HTTP_USER" ]] ; then
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
@ -470,7 +481,59 @@ if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$HTTP_USER
|
||||
fi
|
||||
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
|
||||
if $NGINX_IS_ENABLED ; then
|
||||
|
||||
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE=""
|
||||
fi
|
||||
|
||||
elif $APACHE2_IS_ENABLED ; then
|
||||
|
||||
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
|
||||
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
|
||||
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
PHP_VERSION="$(grep -o -E "php-?.{1}\..{1}-fpm" $VHOST_CONFIG_FILE | grep -o -E ".{1}\..{1}")"
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
fatal "PHP Version must be givven if running PHP-FPM engine (parameter 'PHP_VERSION')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# - Determin PHP binary
|
||||
# -
|
||||
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
|
||||
php_binary="/usr/local/php-${PHP_VERSION}/bin/php"
|
||||
else
|
||||
php_binary="$(realpath "$(which php)")"
|
||||
if [[ -z "$php_binary" ]]; then
|
||||
if [[ -x "/usr/local/php/bin/php" ]]; then
|
||||
php_binary="/usr/local/php/bin/php"
|
||||
else
|
||||
fatal "No PHP binary present"
|
||||
fi
|
||||
else
|
||||
if [[ ! -x "$php_binary" ]]; then
|
||||
fatal "Found PHP binary '$php_binary', but this file is not executable!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---
|
||||
@ -481,8 +544,14 @@ CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
|
||||
#PRIOR_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)"
|
||||
PRIOR_VERSION="$(sudo -u $HTTP_USER /usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ --version | cut -d' ' -f2)"
|
||||
|
||||
DATA_DIR=${WEB_BASE_DIR}/data-${VERSION}
|
||||
CURRENT_DATA_DIR="$(realpath ${WEB_BASE_DIR}/data-$PRIOR_VERSION)"
|
||||
#DATA_DIR=${WEB_BASE_DIR}/data-${VERSION}
|
||||
#CURRENT_DATA_DIR="$(realpath ${WEB_BASE_DIR}/data-$PRIOR_VERSION)"
|
||||
|
||||
DATA_DIR=${WEB_BASE_DIR}/data
|
||||
OLD_DATA_DIR=${WEB_BASE_DIR}/data-${PRIOR_VERSION}
|
||||
|
||||
|
||||
|
||||
|
||||
#_CURRENT_DATA_DIR="$(grep datadirectory "${CURRENT_INSTALL_DIR}/config/config.php" 2> /dev/null \
|
||||
# | awk '{print$3}' \
|
||||
@ -505,16 +574,16 @@ echo ""
|
||||
echo -e " New Installation directory...........: $INSTALL_DIR"
|
||||
echo -e " Old Installation directory...........: $CURRENT_INSTALL_DIR"
|
||||
echo ""
|
||||
echo -e " New Data directory...................: $DATA_DIR"
|
||||
echo -e " Old Data directory...................: $CURRENT_DATA_DIR"
|
||||
echo -e " Data directory........................: $DATA_DIR"
|
||||
echo -e " Old Data directory...................: $OLD_DATA_DIR"
|
||||
echo ""
|
||||
echo -e " Source directory for tar archiv......: $SRC_BASE_DIR"
|
||||
echo ""
|
||||
echo -e " Webserver user.......................: $HTTP_USER"
|
||||
echo -e " Webserver group......................: $HTTP_GROUP"
|
||||
echo ""
|
||||
echo -e " PHP version..........................: $PHP_VERSION"
|
||||
echo -e " PHP Engine...........................: $PHP_ENGINE"
|
||||
echo -e " PHP binary...........................: $php_binary"
|
||||
echo ""
|
||||
echo -e " Databse name.........................: $DATABASE_NAME"
|
||||
echo -e " Database type........................: $DATABASE_TYPE"
|
||||
@ -632,23 +701,47 @@ fi
|
||||
# -
|
||||
echo ""
|
||||
echononl " Stop Apache Webserver.."
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl stop apache2
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
if $APACHE2_IS_ENABLED ; then
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl stop apache2
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
/etc/init.d/apache2 stop
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
fi
|
||||
else
|
||||
/etc/init.d/apache2 stop
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
fi
|
||||
echo_skipped
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
@ -658,26 +751,48 @@ fi
|
||||
# -
|
||||
echo ""
|
||||
echononl " Stop Nginx Webserver.."
|
||||
if $NGINX_IS_ACTIVE ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl stop apache2
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
if $NGINX_IS_ENABLED ; then
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl stop nginx
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
/etc/init.d/nginx stop
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
fi
|
||||
else
|
||||
/etc/init.d/apache2 stop
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
fi
|
||||
echo_skipped
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
fi
|
||||
|
||||
echo ""
|
||||
@ -764,10 +879,10 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# - Kopiere Daten Verzeichnis (hardlinks - harte Dateiverweise)
|
||||
# - Backup Daten Verzeichnis (hardlinks - harte Dateiverweise)
|
||||
# -
|
||||
echononl " Copy (hardlink) old data directory to '$DATA_DIR'.."
|
||||
cp -al ${CURRENT_DATA_DIR} $DATA_DIR > $log_file 2>&1
|
||||
echononl " Copy (hardlink) data directory to '${OLD_DATA_DIR}.$backup_date'.."
|
||||
cp -al "${DATA_DIR}" "${OLD_DATA_DIR}.${backup_date}" > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
@ -799,42 +914,42 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# - Backup old data directory
|
||||
# -
|
||||
echononl " Backup old data directory"
|
||||
_old_data_dir="$(realpath ${WEB_BASE_DIR}/data)"
|
||||
mv "$_old_data_dir" "${_old_data_dir}.$backup_date" > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# - Delete symlink for old data directory
|
||||
# -
|
||||
echononl " Remove symlink from old data dir 'data-${PRIOR_VERSION}'.."
|
||||
rm ${WEB_BASE_DIR}/data > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
fi
|
||||
|
||||
|
||||
# - Set symlink for new data directory
|
||||
# -
|
||||
echononl " Set symlink for new data dir 'data-${VERSION}'.."
|
||||
ln -s data-${VERSION} ${WEB_BASE_DIR}/data > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
fatal "$(cat $log_file)"
|
||||
fi
|
||||
## - Backup old data directory
|
||||
## -
|
||||
#echononl " Backup old data directory"
|
||||
#_old_data_dir="$(realpath ${WEB_BASE_DIR}/data)"
|
||||
#mv "$_old_data_dir" "${_old_data_dir}.$backup_date" > $log_file 2>&1
|
||||
#if [[ $? -eq 0 ]]; then
|
||||
# echo_ok
|
||||
#else
|
||||
# echo_failed
|
||||
# error "$(cat $log_file)"
|
||||
#fi
|
||||
#
|
||||
#
|
||||
#
|
||||
## - Delete symlink for old data directory
|
||||
## -
|
||||
#echononl " Remove symlink from old data dir 'data-${PRIOR_VERSION}'.."
|
||||
#rm ${WEB_BASE_DIR}/data > $log_file 2>&1
|
||||
#if [[ $? -eq 0 ]]; then
|
||||
# echo_ok
|
||||
#else
|
||||
# echo_failed
|
||||
# fatal "$(cat $log_file)"
|
||||
#fi
|
||||
#
|
||||
#
|
||||
## - Set symlink for new data directory
|
||||
## -
|
||||
#echononl " Set symlink for new data dir 'data-${VERSION}'.."
|
||||
#ln -s data-${VERSION} ${WEB_BASE_DIR}/data > $log_file 2>&1
|
||||
#if [[ $? -eq 0 ]]; then
|
||||
# echo_ok
|
||||
#else
|
||||
# echo_failed
|
||||
# fatal "$(cat $log_file)"
|
||||
#fi
|
||||
|
||||
|
||||
# - Set Parameter 'datadirectory' to '${DATA_DIR}' .."
|
||||
@ -1328,46 +1443,50 @@ fi
|
||||
# -
|
||||
echo ""
|
||||
echononl " Start Apache Webserver.."
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl start apache2 > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
if $APACHE2_IS_ENABLED ; then
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl start apache2 > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
else
|
||||
/etc/init.d/apache2 start > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
/etc/init.d/apache2 start > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
fi
|
||||
echo_skipped
|
||||
warn "The webserver was not running, so it will be keept down!"
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
warn "The webserver was not running, so it will be keept down!"
|
||||
fi
|
||||
|
||||
|
||||
@ -1375,48 +1494,53 @@ fi
|
||||
# -
|
||||
echo ""
|
||||
echononl " Start Nginx Webserver.."
|
||||
if $NGINX_IS_ACTIVE ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl start nginx > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
if $NGINX_IS_ENABLED ; then
|
||||
if $IS_HTTPD_RUNNING ; then
|
||||
if $SYSTEMD_EXISTS ; then
|
||||
systemctl start nginx > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
|
||||
fi
|
||||
else
|
||||
/etc/init.d/nginx start > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
/etc/init.d/nginx start > $log_file 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/no]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||
fi
|
||||
echo_skipped
|
||||
warn "The NGINX is not configured as active - so nothing to do."
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
warn "The NGINX is not configured as active - so nothing to do."
|
||||
fi
|
||||
|
||||
|
||||
_redis_cli_bin="$(which redis-cli)"
|
||||
if [[ -z "$_redis_cli_bin" ]]; then
|
||||
if [[ -x "/usr/local/bin/redis-cli" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user