From 18a451ed0758a4f9736fd4ac68d3c51e4ea8d773 Mon Sep 17 00:00:00 2001 From: startxfr Date: Sat, 28 Nov 2015 14:13:04 +0100 Subject: change in os startup --- Services/apache/httpd.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Services/apache/httpd.sh (limited to 'Services/apache/httpd.sh') diff --git a/Services/apache/httpd.sh b/Services/apache/httpd.sh new file mode 100644 index 0000000..0220984 --- /dev/null +++ b/Services/apache/httpd.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +export TERM=dumb +export HTTPDCONF=/etc/httpd/conf.d/sx.conf + +# Begin configuration before starting daemonized process +# and start generating host keys +function begin_config { + echo "=> Begin httpd configuration for host $HOSTNAME" + mkdir -p /var/run/httpd + if [ -z "$DOCROOT" ]; then + echo "===> Changing document root to $DOCROOT" + ${DOCROOT=/var/www/html} + echo "DocumentRoot \"$DOCROOT\"" >> $HTTPDCONF + fi +} + +# End configuration process just before starting daemon +function end_config { + stop_server + echo "=> End httpd configuration ..." +} + +# Start the httpd server in background. Used to perform config +# against the database structure such as user creation +function start_server { + echo "===> Starting httpd server ..." + /usr/sbin/apachectl & + sleep 8 +} + +# Stop the httpd server running in background. +function stop_server { + echo "===> Stopping httpd server ..." + killall httpd + rm -rf /run/httpd/* + sleep 8 +} + +# Start the httpd server as a deamon and execute it inside +# the running shell +function start_daemon { + echo "=> Starting httpd daemon ..." + exec /usr/sbin/apachectl -D FOREGROUND +} + + +if [[ "$0" == *"httpd.sh" && ! $1 = "" ]];then + eval "$@"; +fi \ No newline at end of file -- cgit v1.2.3