3 # H2O - the optimized HTTP/1, HTTP/2 server
6 # description: H2O - the optimized HTTP/1, HTTP/2 server
8 # config: /etc/h2o/h2o.conf
9 # pidfile: /var/run/h2o/h2o.pid
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20 msg_network_down "h2o"
27 # Get service config - may override defaults
28 [ -f /etc/sysconfig/h2o ] && . /etc/sysconfig/h2o
30 # Path to the server binary, and short-form for messages.
33 configfile=/etc/h2o/h2o.conf
34 lockfile=${LOCKFILE-/var/lock/subsys/h2o}
35 pidfile=/var/run/h2o.pid
36 options="-m daemon -c $configfile"
39 # must return non-zero if check failed
40 # output is discarded if checkconfig is ran without details
42 $h2o -t -c ${configfile}
45 # wrapper for configtest
49 if [ $details = 1 ]; then
50 # run config test and display report (status action)
51 show "Checking %s configuration" "h2o"; busy
53 out=$(configtest 2>&1)
55 if [ $RETVAL = 0 ]; then
60 [ "$out" ] && echo >&2 "$out"
62 # run config test and abort with nice message if failed
63 # (for actions checking status before action).
64 configtest >/dev/null 2>&1
66 if [ $RETVAL != 0 ]; then
67 show "Checking %s configuration" "h2o"; fail
68 nls 'Configuration test failed. See details with %s "checkconfig"' $0
75 # Check if the service is already running?
76 if [ -f $lockfile ]; then
77 msg_already_running "h2o"
82 daemon --pidfile $pidfile $h2o $options
84 [ $RETVAL -eq 0 ] && touch $lockfile
88 if [ ! -f $lockfile ]; then
95 killproc --pidfile $pidfile h2o -TERM
100 if [ ! -f $lockfile ]; then
101 msg_not_running "h2o"
108 killproc --pidfile $pidfile h2o -HUP
113 if [ ! -f $lockfile ]; then
114 msg_not_running "h2o"
125 # See how we were called.
144 checkconfig|configtest)
148 status --pidfile $pidfile h2o
152 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"