Now that remconffs is doing real caching, cache for less time
[invirt/packages/invirt-remote.git] / debian / invirt-remote-server.init
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          invirt-remote-server
4 # Required-Start:    $local_fs $remote_fs
5 # Required-Stop:     $local_fs $remote_fs
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: Invirt remctl configuration filesystem
9 # Description:       
10 ### END INIT INFO
11
12 # Author: Invirt project <invirt@mit.edu>
13
14 PATH=/sbin:/usr/sbin:/bin:/usr/bin
15 NAME=invirt-remote-server
16 DESC="the Invirt remctl configuration filesystem"
17 DAEMON=/usr/sbin/invirt-remconffs
18 DAEMON_ARGS="/etc/remctl/remconffs"
19 PIDFILE=/var/run/$NAME.pid
20 SCRIPTNAME=/etc/init.d/$NAME
21 GEN_FILES=/etc/remctl/acl/web
22
23 # Exit if the package is not installed
24 [ -x "$DAEMON" ] || exit 0
25
26 . /lib/init/gen-files.sh
27 . /lib/init/std-init.sh
28
29 do_start()
30 {
31         # Return
32         #   0 if daemon has been started
33         #   1 if daemon was already running
34         #   2 if daemon could not be started
35         gen_files
36         modprobe fuse
37         daemon --running -n $NAME && return 1
38         daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
39 }
40
41 do_stop()
42 {
43         # Return
44         #   0 if daemon has been stopped
45         #   1 if daemon was already stopped
46         #   2 if daemon could not be stopped
47         #   other if a failure occurred
48         daemon --stop -n $NAME
49         RETVAL="$?"
50         [ "$RETVAL" = 2 ] && return 2
51         # Many daemons don't delete their pidfiles when they exit.
52         rm -f $PIDFILE
53         umount "$DAEMON_ARGS"
54         return "$RETVAL"
55 }
56
57 std_init "$1"