summaryrefslogtreecommitdiffstats
path: root/Services/apache/sx-httpd.sh
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2015-11-28 15:15:52 +0100
committerstartxfr <clarue@startx.fr>2015-11-28 15:15:52 +0100
commit4bb17b8c05c6e430293217797eef694671ec1e1b (patch)
tree2aec4634843d5ed54a8e71049e4e564f8d33973d /Services/apache/sx-httpd.sh
parent151b31b6f47fb3d96afdd66138ff40d92cac6202 (diff)
downloadphpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.gz
phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.bz2
phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.xz
phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.zip
final change in script lib for OS. Change in apache and php services
Diffstat (limited to 'Services/apache/sx-httpd.sh')
-rw-r--r--Services/apache/sx-httpd.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/Services/apache/sx-httpd.sh b/Services/apache/sx-httpd.sh
new file mode 100644
index 0000000..ad7b995
--- /dev/null
+++ b/Services/apache/sx-httpd.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+function check_httpd_environment {
+ if [ ! -v SERVER_NAME ]; then
+ export SERVER_NAME=$CONTAINER_NAME
+ fi
+}
+
+# Begin configuration before starting daemonized process
+# and start generating host keys
+function begin_config {
+ echo "=> BEGIN APACHE CONFIGURATION"
+ mkdir -p /var/run/httpd
+ if [ -v DOCROOT ]; then
+ echo "=> Changing document root to $DOCROOT"
+ ${DOCROOT=/data/www}
+ echo "DocumentRoot \"$DOCROOT\"" >> $HTTPDCONF
+ fi
+}
+
+# End configuration process just before starting daemon
+function end_config {
+ stop_server
+ echo "=> END APACHE 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 2
+}
+
+# Stop the httpd server running in background.
+function stop_server {
+ echo "=> Stopping httpd server ..."
+ killall httpd
+ rm -rf /run/httpd/*
+ sleep 2
+}
+
+# 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
+}