-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathh2o
executable file
·55 lines (52 loc) · 1.03 KB
/
h2o
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
### BEGIN INIT INFO
# Provides: h2o
# Required-Start: $network
# Required-Stop: $network
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop h2o
# Description: the optimized HTTP/1.x, HTTP/2 server
### END INIT INFO
INSTDIR=/usr/local/bin
PIDFILE=/var/run/h2o.pid
APP=h2o
case $1 in
start)
if [ -f $PIDFILE ]; then
echo "err: $PIDFILE already exists"
exit 1
fi
$INSTDIR/$APP -m daemon -c /etc/h2o/h2o.conf
exit 0
;;
stop)
if [ -f "/var/run/h2o.pid" ]; then
kill -TERM `cat /var/run/h2o.pid`
echo stopping h2o...
else
echo stopped already
fi
exit 0
;;
status)
if [ -f "/var/run/h2o.pid" ]; then
echo running with PID "`cat /var/run/h2o.pid`"
else
echo stopped
fi
exit 0
;;
restart)
$0 stop && $0 start
;;
force-reload)
$0 restart
;;
*)
echo "Argument \"$1\" not implemented."
exit 2
;;
esac