4 # description: H2O - the optimized HTTP/1, HTTP/2 server
6 # config: /etc/h2o/h2o.conf
7 # pidfile: /var/run/h2o/h2o.pid
11 # Required-Start: $local_fs $remote_fs $network $named
12 # Required-Stop: $local_fs $remote_fs $network
13 # Should-Start: distcache
14 # Short-Description: start and stop h2o HTTP Server
15 # Description: H2O - the optimized HTTP/1, HTTP/2 server
18 # Source function library.
19 . /etc/rc.d/init.d/functions
21 if [ -f /etc/sysconfig/h2o ]; then
25 # Path to the server binary, and short-form for messages.
28 configfile=/etc/h2o/h2o.conf
29 lockfile=${LOCKFILE-/var/lock/subsys/h2o}
31 options="-m daemon -c $configfile"
33 pidfile=`sed -ne 's|pid-file:\s*\([-_./0-9a-zA-Z]\{1,\}\)|\1|p' $configfile`
34 if [ -z "$pidfile" ]; then
35 echo $"pid-file must be defined in $configfile"
40 echo -n $"Starting $prog: "
41 daemon --pidfile=${pidfile} $h2o $options
44 [ $RETVAL = 0 ] && touch ${lockfile}
49 echo -n $"Stopping $prog: "
50 killproc -p ${pidfile} $h2o -TERM
53 [ $RETVAL = 0 ] && rm -f ${lockfile}
57 echo -n $"Reloading $prog: "
58 if ! $h2o -t -c ${configfile} >&/dev/null; then
60 echo $"not reloading due to configuration syntax error"
61 failure $"not reloading $h2o due to configuration syntax error"
63 # Force LSB behaviour from killproc
64 LSB=1 killproc -p ${pidfile} $h2o -HUP
66 if [ $RETVAL -eq 7 ]; then
67 failure $"h2o shutdown"
74 $h2o -t -c ${configfile}
77 # See how we were called.
86 status -p ${pidfile} $h2o
93 condrestart|try-restart)
94 if status -p ${pidfile} $h2o >&/dev/null; then
107 echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|configtest}"