install_roundcube.sh: addes support for systemd apache2 service.

This commit is contained in:
Christoph 2018-05-13 20:36:46 +02:00
parent c4d142561c
commit 519b3f00ab

View File

@ -89,6 +89,44 @@ echo_skipped() {
trap clean_up SIGHUP SIGINT SIGTERM
# - Is 'systemd' supported on this system
# -
systemd_supported=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] && [[ -n "$systemctl" ]] ; then
systemd_supported=true
fi
# - Look for systemd service file or sysv init script for apache2 webservice
# -
APACHE_SERVICE_FILE=""
APACHE_INIT_SCRIPT=""
if $systemd_supported ; then
# - Is Service exclusive controlled by systemd
# -
if systemctl -t service list-unit-files \
| grep -e "^apache" \
| grep -q -E "(enabled|disabled)" 2> /devnull ; then
APACHE_SERVICE_FILE=$(systemctl -t service list-unit-files \
| grep -e "^apache" \
| awk '{print$1}')
fi
fi
if [[ -z "$APACHE_SERVICE_FILE" ]] ; then
if [ -x "/etc/init.d/apache2" ]; then
APACHE_INIT_SCRIPT="/etc/init.d/apache2"
elif [ -x "/etc/init.d/apachectl" ]; then
APACHE_INIT_SCRIPT="/etc/init.d/apachectl"
fi
fi
if [ "$DB_TYPE" = "postgres" -o "$DB_TYPE" = "postgresql" -o "$DB_TYPE" = "pgsql" -o "$DB_TYPE" = "psql" ];then
DB_TYPE=pgsql
fi
@ -1413,10 +1451,11 @@ else
fi
echononl "\tRestart Apache Webservice.."
if $APACHE_DEBIAN_INSTALLATION ; then
/etc/init.d/apache2 reload > $log_file 2>&1
if [[ -n "$APACHE_SERVICE_FILE" ]] || [[ -n "$APACHE_INIT_SCRIPT" ]] ; then
if [[ -n "$APACHE_SERVICE_FILE" ]] ; then
systemctl restart $APACHE_SERVICE_FILE > $log_file 2>&1
else
/etc/init.d/apache2 restart > $log_file 2>&1
$APACHE_INIT_SCRIPT restart > $log_file 2>&1
fi
if [[ $? -eq 0 ]]; then
echo_ok
@ -1424,6 +1463,10 @@ else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
warn "Neither an init-script nor a service file for 'apache2' webservice found!"
fi
# - Install a cronjob for cleaning up tmp-directory
# -