Ticket #144: deepamehta-init.patch

File deepamehta-init.patch, 2.9 KB (added by JuergeN, 11 years ago)

Patch for /etc/init.d/deepamehta

  • /etc/init.d/deepamehta

    old new  
    8888        #   0 if daemon has been started 
    8989        #   1 if daemon was already running 
    9090        #   2 if daemon could not be started 
    91         echo -n "   Starting $DESC ... " 
     91        echo -n "\n   Starting $DESC ... " 
    9292        status_of_daemon || ( [ "$?" = 1 ] && start-stop-daemon --start $EXTRA_ARGS --quiet --pidfile $PIDFILE --startas $DAEMON $DAEMON_ARGS ) 
    9393        # Add code here, if necessary, that waits for the process to be ready 
    9494        # to handle requests from services started subsequently which depend 
     
    9797        # Sleep at least 8 seconds to check if deepamehta is running! 
    9898        sleep 8 
    9999        # Now check if we can find the according java process. 
    100         status_of_daemon && echo "done." || ( echo "   stopped!"; [ -f $PIDFILE ] && rm $PIDFILE ) 
     100        status_of_daemon && echo "done.\n" || ( echo "   stopped!\n"; [ -f $PIDFILE ] && rm $PIDFILE ) 
    101101} 
    102102 
    103103# 
     
    110110        #   1 if daemon was already stopped 
    111111        #   2 if daemon could not be stopped 
    112112        #   other if a failure occurred 
    113         echo -n "   Stopping $DESC ... " 
     113        echo -n "\n   Stopping $DESC ... " 
    114114        status_of_daemon && start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE  
    115115        RETVAL="$?" 
    116         status_of_daemon || echo "done." 
     116        status_of_daemon || echo "done.\n" 
    117117        [ "$RETVAL" = 2 ] && return 2 
    118118        # Wait for children to finish too if this is a daemon that forks 
    119119        # and if the daemon is only ever run from this initscript. 
     
    145145case "$1" in 
    146146  start) 
    147147        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" 
    148         status_of_daemon || ( [ "$?" = 1 ] && do_start ) 
     148        status_of_daemon || ( [ "$?" = 1 ] && ( [ ! -z $LOG_DEEPAMEHTA_INIT ] && echo "\n$( date +%d.%m.%Y" "%H:%M:%S ) *** Starting $DESC ***">>$LOG_DEEPAMEHTA_INIT ); do_start ) 
    149149        case "$?" in 
    150150                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
    151151                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
     
    153153        ;; 
    154154  stop) 
    155155        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" 
    156         status_of_daemon && do_stop 
     156        status_of_daemon && ( do_stop; ( [ ! -z $LOG_DEEPAMEHTA_INIT ] && echo "$( date +%d.%m.%Y" "%H:%M:%S ) *** Stopping $DESC ***">>$LOG_DEEPAMEHTA_INIT ) ) 
    157157        case "$?" in 
    158158                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
    159159                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
    160160        esac 
    161161        ;; 
    162162  status) 
    163        status_of_daemon && echo "   $DESC is running with PID $PIDLNUM." || echo "   $DESC is not running." 
     163       status_of_daemon && echo "\n   $DESC is running with PID $PIDLNUM.\n" || echo "\n   $DESC is not running.\n" 
    164164       ;; 
    165165  restart|force-reload) 
    166166        # 
     
    171171        status_of_daemon && do_stop 
    172172        case "$?" in 
    173173          0|1) 
    174                 do_start 
     174                ( [ ! -z $LOG_DEEPAMEHTA_INIT ] && echo "\n$( date +%d.%m.%Y" "%H:%M:%S ) *** Restarting $DESC ***">>$LOG_DEEPAMEHTA_INIT ); do_start 
    175175                case "$?" in 
    176176                        0) log_end_msg 0 ;; 
    177177                        1) log_end_msg 1 ;; # Old process is still running