install_httpd-2.4.sh: add clean_up function.

This commit is contained in:
Christoph 2019-07-12 01:27:28 +02:00
parent 034d7f919e
commit 08c187280a

View File

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