source: package_tags/sipb-xen-remote-server/0.9.1/debian/sipb-xen-remote-server.init @ 2917

Last change on this file since 2917 was 525, checked in by price, 16 years ago

init script for remconffs

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          sipb-xen-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: sipb-xen remctl configuration filesystem
9# Description:       
10### END INIT INFO
11
12# Author: SIPB Xen Project <sipb-xen@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 sipb-xen remctl configuration filesystem"
19NAME=sipb-xen-remconffs
20DAEMON=/usr/sbin/sipb-xen-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
38#
39# Function that starts the daemon/service
40#
41do_start()
42{
43        # Return
44        #   0 if daemon has been started
45        #   1 if daemon was already running
46        #   2 if daemon could not be started
47        modprobe fuse
48        daemon --running -n $NAME && return 1
49        daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
50}
51
52#
53# Function that stops the daemon/service
54#
55do_stop()
56{
57        # Return
58        #   0 if daemon has been stopped
59        #   1 if daemon was already stopped
60        #   2 if daemon could not be stopped
61        #   other if a failure occurred
62        daemon --stop -n $NAME
63        RETVAL="$?"
64        [ "$RETVAL" = 2 ] && return 2
65        # Many daemons don't delete their pidfiles when they exit.
66        rm -f $PIDFILE
67        umount "$DAEMON_ARGS"
68        return "$RETVAL"
69}
70
71case "$1" in
72  start)
73        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
74        do_start
75        case "$?" in
76                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
77                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
78        esac
79        ;;
80  stop)
81        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
82        do_stop
83        case "$?" in
84                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
85                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
86        esac
87        ;;
88  #reload|force-reload)
89        #
90        # If do_reload() is not implemented then leave this commented out
91        # and leave 'force-reload' as an alias for 'restart'.
92        #
93        #log_daemon_msg "Reloading $DESC" "$NAME"
94        #do_reload
95        #log_end_msg $?
96        #;;
97  restart|force-reload)
98        #
99        # If the "reload" option is implemented then remove the
100        # 'force-reload' alias
101        #
102        log_daemon_msg "Restarting $DESC" "$NAME"
103        do_stop
104        case "$?" in
105          0|1)
106                do_start
107                case "$?" in
108                        0) log_end_msg 0 ;;
109                        1) log_end_msg 1 ;; # Old process is still running
110                        *) log_end_msg 1 ;; # Failed to start
111                esac
112                ;;
113          *)
114                # Failed to stop
115                log_end_msg 1
116                ;;
117        esac
118        ;;
119  *)
120        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
121        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
122        exit 3
123        ;;
124esac
125
126:
Note: See TracBrowser for help on using the repository browser.