source: trunk/packages/sipb-xen-console/debian/sipb-xen-console.init @ 370

Last change on this file since 370 was 344, checked in by broder, 17 years ago

New sipb-xen-console. Now with more magic - and more working

This package installed onto a clean Debian system should do all of the setup
for a console server except for copying the ssh private keys, granting access
to the Postgres database, and Kerberos keytabs

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