aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-13 16:24:09 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-13 16:24:09 +0200
commita07be667cda3ebbf4acfe86b9c0f67a302db661a (patch)
tree553b6294a55cbaa3e123b73d836756398653ea8c
parent8fcd75747b51525922032ba4ced87fab288bca1e (diff)
downloadrbsd-a07be667cda3ebbf4acfe86b9c0f67a302db661a.tar.gz
Add /etc/rc.d/apache
-rwxr-xr-xetc/rc.d/apache57
1 files changed, 57 insertions, 0 deletions
diff --git a/etc/rc.d/apache b/etc/rc.d/apache
new file mode 100755
index 0000000..dc17ffd
--- /dev/null
+++ b/etc/rc.d/apache
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# $NetBSD: apache.sh,v 1.1.1.1 2012/04/13 18:50:49 ryoon Exp $
+#
+# PROVIDE: apache
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start Apache:
+#
+# apache=YES
+
+name="apache"
+
+if [ -f /etc/rc.subr ]
+then
+ . /etc/rc.subr
+
+ rcvar=$name
+ command="/usr/pkg/sbin/httpd"
+ command_args="-k start"
+ pidfile="/var/run/httpd.pid"
+ required_files="/usr/pkg/etc/httpd/httpd.conf"
+ extra_commands="reload"
+ reload_cmd="$command -k graceful"
+
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ ctl_command="/usr/pkg/sbin/apachectl"
+
+ if [ ! -x ${ctl_command} ]; then
+ return
+ fi
+
+ case "$1" in
+ start)
+ echo "Starting ${name}."
+ ${ctl_command} start
+ ;;
+ stop)
+ echo "Stopping ${name}."
+ ${ctl_command} stop
+ ;;
+ reload)
+ ${ctl_command} graceful
+ ;;
+ restart)
+ "$0" stop
+ sleep 10
+ "$0" start
+ ;;
+ *)
+ ${ctl_command} "$1"
+ ;;
+ esac
+fi