Bump version requirement for perlbal
[MogileFS-Server.git] / debian / mogilefsd.init
blob75c1355948379c1b04b44383577cba247c6e458a
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: mogilefsd
4 # Required-Start: $local_fs $remote_fs $network $syslog
5 # Required-Stop: $local_fs $remote_fs $network $syslog
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
8 # Short-Description: Start/Stop the mogilefsd daemon
9 # Description: Start/Stop the mogilefsd daemon.
10 ### END INIT INFO
12 # PATH should only include /usr/* if it runs after the mountnfs.sh script
13 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14 DAEMON=/usr/bin/mogilefsd
15 NAME=mogilefsd
16 DESC=mogilefsd
17 DEFAULTS=/etc/default/$NAME
18 PIDFILE=/var/run/$NAME.pid
19 SCRIPTNAME=/etc/init.d/$NAME
21 # Exit if the package is not installed
22 [ -x "$DAEMON" ] || exit 0
24 # Read configuration variable file if it is present
25 if [ -r $DEFAULTS ] ; then
27 . $DEFAULTS
29 if [ -z "$MOGILEFSD_RUNASUSER" ]; then
30 echo "Cannot determine user to run as, even though defaults file ($DEFAULTS) exists."
31 echo "Please run dpkg-reconfigure $NAME to correct the problem."
32 exit 0
34 else
35 echo "Can't start $NAME. Defaults file ($DEFAULTS) doesn't exist."
36 echo "Please run dpkg-reconfigure $NAME to correct the problem."
37 exit 0
40 # Load the VERBOSE setting and other rcS variables
41 . /lib/init/vars.sh
43 set -e
46 # Function that starts the daemon/service
48 do_start()
50 if [ -e $PIDFILE ]
51 then
53 if [ -d /proc/`cat $PIDFILE`/ ]
54 then
56 echo "$NAME already running."
57 exit 0;
58 else
59 rm -f $PIDFILE
64 start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -b -m --name $NAME --chuid $MOGILEFSD_RUNASUSER
68 # Function that stops the daemon/service
70 do_stop()
72 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME --user $MOGILEFSD_RUNASUSER
73 rm -f $PIDFILE
76 case "$1" in
77 start)
78 echo -n "Starting $DESC: "
79 do_start
80 echo "$NAME."
82 stop)
83 echo -n "Stopping $DESC: "
84 do_stop
85 echo "$NAME."
88 restart|force-reload)
90 # If the "reload" option is implemented, move the "force-reload"
91 # option to the "reload" entry above. If not, "force-reload" is
92 # just the same as "restart".
94 echo -n "Restarting $DESC: "
95 do_stop
96 sleep 1
97 do_start
98 echo "$NAME."
101 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
102 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
103 exit 3
105 esac