Drop patches
[pkg-ocaml-ocsigen.git] / debian / ocsigen.init
blob4738cc3d555747cfe417d80723c048138dd36dc1
1 #! /bin/sh
3 # Init script written by Samuel Mimram <smimram@debian.org>.
5 ### BEGIN INIT INFO
6 # Provides: ocsigen
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
12 # Default-Stop: 0 1 6
13 # Short-Description: ocsigen web server.
14 # Description: ocsigen web server.
15 ### END INIT INFO
17 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18 DAEMON=/usr/bin/ocsigen
19 NAME=ocsigen
20 DESC=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
28 . $DEFAULTFILE
31 set -e
33 case "$1" in
34 start|force-start)
35 if [ "x$LAUNCH_AT_STARTUP" != "xtrue" ] && [ "x$1" = "xstart" ]; then
36 echo "$DEFAULTFILE prevents $NAME to be started (use force-start)."
37 exit 0
39 if [ -r "$PIDFILE" ] && read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
40 echo "$NAME is already running!"
41 exit 0
43 echo -n "Starting $DESC: "
44 $DAEMON --daemon --pidfile $PIDFILE $DAEMON_OPTS
45 echo "$NAME."
47 stop)
48 echo -n "Stopping $DESC: "
49 for pid in `cat $PIDFILE`; do kill $pid || true; done
50 rm -f $PIDFILE
51 echo "$NAME."
53 reload)
54 echo -n "Reloading $DESC: "
55 echo reload > /var/run/ocsigen_command
56 echo "$NAME."
58 restart|force-reload)
59 $0 stop
60 $0 start
62 status)
63 echo -n "Status of $DESC: "
64 if [ ! -r "$PIDFILE" ]; then
65 echo "$NAME is not running."
66 exit 3
68 if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
69 echo "$NAME is running."
70 exit 0
71 else
72 echo "$NAME is not running but $PIDFILE exists."
73 exit 1
77 N=/etc/init.d/$NAME
78 echo "Usage: $N {start|stop|restart|reload|force-reload|force-start|status}" >&2
79 exit 1
81 esac
83 exit 0