Changeset 1534 for trunk


Ignore:
Timestamp:
Nov 5, 2008, 8:00:52 PM (16 years ago)
Author:
price
Message:

shorten invirt-remote-server initscript with std-init, correct the usage message

Location:
trunk/packages/invirt-remote-server/debian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-remote-server/debian/changelog

    r1411 r1534  
     1invirt-remote-server (0.0.12) unstable; urgency=low
     2
     3  * shorten initscript with std-init, correct the usage message
     4
     5 -- Greg Price <price@mit.edu>  Wed, 5 Nov 2008 19:59:18 -0400
     6
    17invirt-remote-server (0.0.11) unstable; urgency=low
    28
  • trunk/packages/invirt-remote-server/debian/invirt-remote-server.init

    r1224 r1534  
    1212# Author: Invirt project <invirt@mit.edu>
    1313
    14 # Do NOT "set -e"
    15 
    16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
    1714PATH=/sbin:/usr/sbin:/bin:/usr/bin
     15NAME=invirt-remote-server
    1816DESC="the Invirt remctl configuration filesystem"
    19 NAME=invirt-remconffs
    2017DAEMON=/usr/sbin/invirt-remconffs
    2118DAEMON_ARGS="/etc/remctl/remconffs"
    2219PIDFILE=/var/run/$NAME.pid
    2320SCRIPTNAME=/etc/init.d/$NAME
     21GEN_FILES=/etc/remctl/acl/web
    2422
    2523# Exit if the package is not installed
    2624[ -x "$DAEMON" ] || exit 0
    2725
    28 # Read configuration variable file if it is present
    29 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
     26. /lib/init/gen-files.sh
     27. /lib/init/std-init.sh
    3028
    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 gen_config()
    39 {
    40         for i in /etc/remctl/acl/web; do
    41                 mako-render $i.mako > $i
    42         done
    43 }
    44 
    45 #
    46 # Function that starts the daemon/service
    47 #
    4829do_start()
    4930{
     
    5233        #   1 if daemon was already running
    5334        #   2 if daemon could not be started
    54         gen_config
     35        gen_files
    5536        modprobe fuse
    5637        daemon --running -n $NAME && return 1
     
    5839}
    5940
    60 #
    61 # Function that stops the daemon/service
    62 #
    6341do_stop()
    6442{
     
    7755}
    7856
    79 case "$1" in
    80   start)
    81         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    82         do_start
    83         case "$?" in
    84                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    85                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    86         esac
    87         ;;
    88   stop)
    89         [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    90         do_stop
    91         case "$?" in
    92                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    93                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    94         esac
    95         ;;
    96   #reload|force-reload)
    97         #
    98         # If do_reload() is not implemented then leave this commented out
    99         # and leave 'force-reload' as an alias for 'restart'.
    100         #
    101         #log_daemon_msg "Reloading $DESC" "$NAME"
    102         #do_reload
    103         #log_end_msg $?
    104         #;;
    105   restart|force-reload)
    106         #
    107         # If the "reload" option is implemented then remove the
    108         # 'force-reload' alias
    109         #
    110         log_daemon_msg "Restarting $DESC" "$NAME"
    111         do_stop
    112         case "$?" in
    113           0|1)
    114                 do_start
    115                 case "$?" in
    116                         0) log_end_msg 0 ;;
    117                         1) log_end_msg 1 ;; # Old process is still running
    118                         *) log_end_msg 1 ;; # Failed to start
    119                 esac
    120                 ;;
    121           *)
    122                 # Failed to stop
    123                 log_end_msg 1
    124                 ;;
    125         esac
    126         ;;
    127   *)
    128         #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    129         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    130         exit 3
    131         ;;
    132 esac
    133 
    134 :
     57std_init "$1"
Note: See TracChangeset for help on using the changeset viewer.