Ignore:
Timestamp:
Oct 24, 2008, 3:35:35 AM (16 years ago)
Author:
price
Message:

fix old bug in invirt-console-host initscript

Also simplify initscript dramatically, like our other good initscripts.

Location:
trunk/packages/invirt-console-host/debian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-console-host/debian/changelog

    r1187 r1198  
     1invirt-console-host (0.0.2) unstable; urgency=low
     2
     3  * make initscript start conserver on start/restart, not just reload
     4  * drastically shorten initscript to current Invirt best practice,
     5    in hopes that such dumb bugs can't hide so easily
     6
     7 -- Greg Price <price@mit.edu>  Fri, 24 Oct 2008 03:33:32 -0400
     8
    19invirt-console-host (0.0.1) unstable; urgency=low
    210
  • trunk/packages/invirt-console-host/debian/invirt-console-host.init

    r1187 r1198  
    66# Default-Start:     2 3 4 5
    77# Default-Stop:      0 1 6
    8 # Short-Description: conserver config from invirt config for invirt host
     8# Short-Description: conserver config from invirt-config for Invirt host
    99# Description:       
    1010### END INIT INFO
    1111
    12 # Author: Invirt/XVM Project, MIT SIPB <invirt@mit.edu>
     12PACKAGE=invirt-console-host
     13PARENTPACKAGE=conserver-server
    1314
    14 # Do NOT "set -e"
     15dpkg -s "$PACKAGE" >/dev/null 2>/dev/null || exit 0
    1516
    16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
    17 PATH=/sbin:/usr/sbin:/bin:/usr/bin
    18 DESC="Invirt host console config"
    19 NAME=invirt-console-host
    20 SCRIPTNAME=/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
    2617. /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.
    3018. /lib/lsb/init-functions
    3119
     
    3725}
    3826
    39 #
    40 # Function that starts the daemon/service
    41 #
    42 do_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 #
    55 do_stop()
    56 {
    57         return 1
    58 }
    59 
    60 do_reload()
    61 {
    62         gen_config
    63         VERBOSE=no /etc/init.d/conserver-server reload
    64 }
    65 
    6627case "$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         ;;
     28  start|reload|force-reload|restart)
     29    log_begin_msg "Reloading config for $PACKAGE"
     30    gen_config
     31    log_end_msg $?
     32    /etc/init.d/"$PARENTPACKAGE" "$1"
     33    ;;
    7534  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         ;;
     35    /etc/init.d/"$PARENTPACKAGE" "$1"
     36    ;;
    10637  *)
    107         echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    108         exit 3
    109         ;;
     38    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
     39    ;;
    11040esac
    111 
    112 :
Note: See TracChangeset for help on using the changeset viewer.