aboutsummaryrefslogtreecommitdiffstats
path: root/testing/h2o/h2o.initd
diff options
context:
space:
mode:
authorBennett Goble <nivardus@gmail.com>2015-07-03 14:10:12 -0400
committerBartłomiej Piotrowski <b@bpiotrowski.pl>2015-07-04 19:10:18 +0200
commitfaa11c327beef4f2ce95e635399e3a459cc58c53 (patch)
treeac50cb53cf673d74a4c31d311b3310c0f37130d7 /testing/h2o/h2o.initd
parentaaa28b17629cf8def22c010ecc7f20e9cc842e38 (diff)
testing/h2o: new aport
https://h2o.examp1e.net An optimized HTTP/1, HTTP/2 server written in C
Diffstat (limited to 'testing/h2o/h2o.initd')
-rw-r--r--testing/h2o/h2o.initd45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/h2o/h2o.initd b/testing/h2o/h2o.initd
new file mode 100644
index 00000000000..47e301d3349
--- /dev/null
+++ b/testing/h2o/h2o.initd
@@ -0,0 +1,45 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload"
+extra_commands="configtest"
+conffile=/etc/h2o.conf
+pidfile=/var/run/h2o.pid
+command=/usr/bin/h2o
+command_args="-c $conffile -m master"
+
+depend() {
+ need net
+ after sshd
+ use dns logger netmount
+}
+
+start_pre() {
+ configtest || return 1
+}
+
+start() {
+ ebegin "Starting h2o"
+ start-stop-daemon --start \
+ --background \
+ --pidfile ${pidfile} \
+ --exec ${command} \
+ -- ${command_args}
+ eend $?
+}
+
+reload() {
+ configtest || return 1
+ ebegin "Refreshing h2o configuration"
+ kill -HUP `cat $pidfile` &>/dev/null
+ eend $? "Failed to reload h2o"
+}
+
+configtest() {
+ ebegin "Checking h2o configuration"
+
+ if [ ! -f "${conffile}" ]; then
+ ewarn "${conffile} does not exist."
+ return 1
+ fi
+}
+