source: trunk/packages/sipb-xen-remctl-auto/debian/sipb-xen-remctl-auto.init @ 835

Last change on this file since 835 was 834, checked in by y_z, 16 years ago

use invirt config in sipb-xen-lvm and to generate /etc/remctl/acl/remote

  • Property svn:executable set to *
File size: 2.2 KB
RevLine 
[834]1#! /bin/bash
[815]2### BEGIN INIT INFO
[834]3# Provides:          sipb-xen-remctl-auto
[815]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: conserver config from invirt config for invirt host
9# Description:       
10### END INIT INFO
11
12# Author: Invirt/XVM Project, MIT SIPB <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="Invirt host console config"
[834]19NAME=sipb-xen-remctl-auto
[815]20SCRIPTNAME=/etc/init.d/$NAME
21
22# Read configuration variable file if it is present
23[ -r /etc/default/$NAME ] && . /etc/default/$NAME
24
25# Load the VERBOSE setting and other rcS variables
26. /lib/init/vars.sh
27
28# Define LSB log_* functions.
29# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
30. /lib/lsb/init-functions
31
32gen_config()
33{
[834]34    echo "host/$(invirt-getconf remote.hostname)@$(invirt-getconf authn.0.realm)" \
35        > /etc/remctl/acl/remote
[815]36}
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        gen_config
48}
49
50#
51# Function that stops the daemon/service
52#
53do_stop()
54{
[834]55        return 0
[815]56}
57
58do_reload()
59{
60        gen_config
61}
62
63case "$1" in
64  start)
65        [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
66        do_start
67        case "$?" in
68                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
69                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
70        esac
71        ;;
72  stop)
73        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
74        do_stop
75        case "$?" in
76                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
77                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
78        esac
79        ;;
80  reload|force-reload)
81        log_daemon_msg "Reloading $DESC" "$NAME"
82        do_reload
83        log_end_msg $?
84        ;;
85  restart)
86        log_daemon_msg "Restarting $DESC" "$NAME"
87        do_stop
88        case "$?" in
89          0|1)
90                do_start
91                case "$?" in
92                        0) log_end_msg 0 ;;
93                        1) log_end_msg 1 ;; # Old process is still running
94                        *) log_end_msg 1 ;; # Failed to start
95                esac
96                ;;
97          *)
98                # Failed to stop
99                log_end_msg 1
100                ;;
101        esac
102        ;;
103  *)
104        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
105        exit 3
106        ;;
107esac
108
109:
Note: See TracBrowser for help on using the repository browser.