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

Last change on this file since 999 was 889, checked in by y_z, 16 years ago

generate config files using mako

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          sipb-xen-console-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: 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"
19NAME=sipb-xen-console-server
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{
34        for i in /etc/conserver/invirt-genconfig.cf
35        do mako-render $i.mako > $i
36        done
37}
38
39#
40# Function that starts the daemon/service
41#
42do_start()
43{
44        # Return
45        #   0 if daemon has been started
46        #   1 if daemon was already running
47        #   2 if daemon could not be started
48        gen_config
49        VERBOSE=no /etc/init.d/conserver-server reload
50}
51
52#
53# Function that stops the daemon/service
54#
55do_stop()
56{
57        return 1
58}
59
60do_reload()
61{
62        gen_config
63        VERBOSE=no /etc/init.d/conserver-server reload
64}
65
66case "$1" in
67  start)
68        [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
69        do_start
70        case "$?" in
71                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
72                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
73        esac
74        ;;
75  stop)
76        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
77        do_stop
78        case "$?" in
79                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
80                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
81        esac
82        ;;
83  reload|force-reload)
84        log_daemon_msg "Reloading $DESC" "$NAME"
85        do_reload
86        log_end_msg $?
87        ;;
88  restart)
89        log_daemon_msg "Restarting $DESC" "$NAME"
90        do_stop
91        case "$?" in
92          0|1)
93                do_start
94                case "$?" in
95                        0) log_end_msg 0 ;;
96                        1) log_end_msg 1 ;; # Old process is still running
97                        *) log_end_msg 1 ;; # Failed to start
98                esac
99                ;;
100          *)
101                # Failed to stop
102                log_end_msg 1
103                ;;
104        esac
105        ;;
106  *)
107        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
108        exit 3
109        ;;
110esac
111
112:
Note: See TracBrowser for help on using the repository browser.