source: trunk/packages/invirt-remote-server/debian/invirt-remote-server.init @ 1209

Last change on this file since 1209 was 1181, checked in by price, 16 years ago

actually configurize acl/web in invirt-remote-server

  • Property svn:executable set to *
File size: 3.0 KB
Line 
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: SIPB Invirt Project <invirt@mit.edu>
13
14# Do NOT "set -e"
15
16# PATH should only include /usr/* if it runs after the mountnfs.sh script
17PATH=/sbin:/usr/sbin:/bin:/usr/bin
18DESC="the Invirt remctl configuration filesystem"
19NAME=invirt-remconffs
20DAEMON=/usr/sbin/invirt-remconffs
21DAEMON_ARGS="/etc/remctl/remconffs"
22PIDFILE=/var/run/$NAME.pid
23SCRIPTNAME=/etc/init.d/$NAME
24
25# Exit if the package is not installed
26[ -x "$DAEMON" ] || exit 0
27
28# Read configuration variable file if it is present
29[ -r /etc/default/$NAME ] && . /etc/default/$NAME
30
31# Load the VERBOSE setting and other rcS variables
32. /lib/init/vars.sh
33
34# Define LSB log_* functions.
35# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
36. /lib/lsb/init-functions
37
38gen_config()
39{
40        for i in /etc/remctl/acl/web; do
41                mako-render $i.mako > $i
42        done
43}
44
45#
46# Function that starts the daemon/service
47#
48do_start()
49{
50        # Return
51        #   0 if daemon has been started
52        #   1 if daemon was already running
53        #   2 if daemon could not be started
54        gen_config
55        modprobe fuse
56        daemon --running -n $NAME && return 1
57        daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
58}
59
60#
61# Function that stops the daemon/service
62#
63do_stop()
64{
65        # Return
66        #   0 if daemon has been stopped
67        #   1 if daemon was already stopped
68        #   2 if daemon could not be stopped
69        #   other if a failure occurred
70        daemon --stop -n $NAME
71        RETVAL="$?"
72        [ "$RETVAL" = 2 ] && return 2
73        # Many daemons don't delete their pidfiles when they exit.
74        rm -f $PIDFILE
75        umount "$DAEMON_ARGS"
76        return "$RETVAL"
77}
78
79case "$1" in
80  start)
81        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
82        do_start
83        case "$?" in
84                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
85                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
86        esac
87        ;;
88  stop)
89        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
90        do_stop
91        case "$?" in
92                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
93                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
94        esac
95        ;;
96  #reload|force-reload)
97        #
98        # If do_reload() is not implemented then leave this commented out
99        # and leave 'force-reload' as an alias for 'restart'.
100        #
101        #log_daemon_msg "Reloading $DESC" "$NAME"
102        #do_reload
103        #log_end_msg $?
104        #;;
105  restart|force-reload)
106        #
107        # If the "reload" option is implemented then remove the
108        # 'force-reload' alias
109        #
110        log_daemon_msg "Restarting $DESC" "$NAME"
111        do_stop
112        case "$?" in
113          0|1)
114                do_start
115                case "$?" in
116                        0) log_end_msg 0 ;;
117                        1) log_end_msg 1 ;; # Old process is still running
118                        *) log_end_msg 1 ;; # Failed to start
119                esac
120                ;;
121          *)
122                # Failed to stop
123                log_end_msg 1
124                ;;
125        esac
126        ;;
127  *)
128        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
129        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
130        exit 3
131        ;;
132esac
133
134:
Note: See TracBrowser for help on using the repository browser.