summaryrefslogtreecommitdiff
path: root/www/apache20/files/apache.sh
diff options
context:
space:
mode:
Diffstat (limited to 'www/apache20/files/apache.sh')
-rw-r--r--www/apache20/files/apache.sh66
1 files changed, 50 insertions, 16 deletions
diff --git a/www/apache20/files/apache.sh b/www/apache20/files/apache.sh
index ab1a71895d0c..0ed476f53974 100644
--- a/www/apache20/files/apache.sh
+++ b/www/apache20/files/apache.sh
@@ -1,17 +1,51 @@
#!/bin/sh
-PREFIX=@@PREFIX@@
-
-case "$1" in
-start)
- [ "@@SSL@@" = "ssl" -a -f "$PREFIX/etc/apache2/ssl.crt/server.crt" ] && SSL=ssl
- [ -x ${PREFIX}/sbin/apachectl ] && ${PREFIX}/sbin/apachectl start${SSL} > /dev/null && echo -n ' apache2'
- ;;
-stop)
- [ -r /var/run/httpd.pid ] && ${PREFIX}/sbin/apachectl stop > /dev/null && echo -n ' apache2'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop}" >&2
- ;;
-esac
-
-exit 0
+#
+# $FreeBSD$
+#
+
+# PROVIDE: apache2
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable apache2:
+# apache2_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable apache2
+# apache2ssl_enable (bool): Set to "NO" by default.
+# Set it to "YES" to start apache with SSL
+# (if <IfDefined SSL> exists in httpd.conf)
+# apache2limits_enable (bool):Set to "NO" by default.
+# Set it to yes to run `limits $limits_args`
+# just before apache starts.
+# apache2_flags (str): Set to "" by default.
+# Extra flags passed to start command
+# apache2limits_args (str): Default to "-e -U %%WWWOWN%%"
+# Arguments of pre-start limits run.
+#
+. %%RC_SUBR%%
+
+name="apache2"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/sbin/httpd"
+pidfile="/var/run/httpd.pid"
+required_files=%%PREFIX%%/etc/apache2/httpd.conf
+
+[ -z "$apache2_enable" ] && apache2_enable="NO"
+[ -z "$apache2ssl_enable" ] && apache2ssl_enable="NO"
+[ -z "$apache2_flags" ] && apache2_flags=""
+[ -z "$apache2limits_enable" ] && apache2limits_enable="NO"
+[ -z "$apache2limits_args" ] && apache2limits_args="-e -U %%WWWOWN%%"
+
+load_rc_config $name
+
+checkyesno apache2ssl_enable && \
+ apache2_flags="-DSSL $apache2_flags"
+
+checkyesno apache2limits_enable && \
+ start_precmd="`/usr/bin/limits ${apache2limits_args}`"
+
+sig_reload=SIGUSR1
+
+run_rc_command "$1"