3 # Init script written by Samuel Mimram <smimram@debian.org>.
7 # Required-Start: $syslog $network $remote_fs
8 # Required-Stop: $syslog $network $remote_fs
9 # Should-Start: $local_fs
10 # Should-Stop: $local_fs
11 # Default-Start: 2 3 4 5
13 # Short-Description: ocsigen web server.
14 # Description: ocsigen web server.
17 PATH
=/usr
/local
/sbin
:/usr
/local
/bin
:/sbin
:/bin
:/usr
/sbin
:/usr
/bin
18 DAEMON
=/usr
/bin
/ocsigen
21 PIDFILE
=/var
/run
/$NAME.pid
22 DEFAULTFILE
=/etc
/default
/ocsigen
24 test -x $DAEMON ||
exit 0
26 # Include ocsigen defaults if available
27 if [ -f $DEFAULTFILE ] ; then
35 if [ "x$LAUNCH_AT_STARTUP" != "xtrue" ] && [ "x$1" = "xstart" ]; then
36 echo "$DEFAULTFILE prevents $NAME to be started (use force-start)."
39 if [ -r "$PIDFILE" ] && read pid
< "$PIDFILE" && ps
-p "$pid" > /dev
/null
2>&1; then
40 echo "$NAME is already running!"
43 echo -n "Starting $DESC: "
44 $DAEMON --daemon --pidfile $PIDFILE $DAEMON_OPTS
48 echo -n "Stopping $DESC: "
49 for pid
in `cat $PIDFILE`; do kill $pid || true
; done
54 echo -n "Reloading $DESC: "
55 echo reload
> /var
/run
/ocsigen_command
63 echo -n "Status of $DESC: "
64 if [ ! -r "$PIDFILE" ]; then
65 echo "$NAME is not running."
68 if read pid
< "$PIDFILE" && ps
-p "$pid" > /dev
/null
2>&1; then
69 echo "$NAME is running."
72 echo "$NAME is not running but $PIDFILE exists."
78 echo "Usage: $N {start|stop|restart|reload|force-reload|force-start|status}" >&2