diff --git a/install_httpd-2.4.sh b/install_httpd-2.4.sh index f176bd2..eb746d7 100755 --- a/install_httpd-2.4.sh +++ b/install_httpd-2.4.sh @@ -173,6 +173,16 @@ export MAKEFLAGS=-j$(expr `grep "^processor" /proc/cpuinfo | sort -u | wc -l` + ## --- some functions ## --- +clean_up() { + + # Perform program exit housekeeping + if [[ -s "$_CRONTAB_BAKUP_FILE" ]]; then + crontab -u root $_CRONTAB_BAKUP_FILE + fi + rm -f $_CRONTAB_BAKUP_FILE + exit $1 +} + echononl(){ echo X\\c > /tmp/shprompt$$ if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then @@ -189,7 +199,7 @@ fatal(){ echo "" echo -e "\t\033[31m\033[1mInstalllation wird abgebrochen\033[m\033[m" echo "" - exit 1 + clean_up 1 } warn (){ @@ -217,6 +227,10 @@ echo_skipped() { ## --- END: functions +trap clean_up SIGHUP SIGINT SIGTERM + + + clear echo echo -e "\033[21G\033[32mInstallation script apache webserver \033[m" @@ -2045,7 +2059,7 @@ if [ -f $_httpdconf ];then fi echo "" >> ${_logdir}/main.log - echo "## - Change ownership of '$MUTEX_DIR' to '$HTTPD_USER'.." + echo "## - Change ownership of '$MUTEX_DIR' to '$HTTPD_USER'.." >> ${_logdir}/main.log echo "## -" >> ${_logdir}/main.log echo "chown $HTTPD_USER $MUTEX_DIR" >> ${_logdir}/main.log echononl "\tChange ownership of '$MUTEX_DIR' to '$HTTPD_USER'.." @@ -4215,4 +4229,4 @@ fi cd $pwd echo -exit 0 +clean_up 0