Ticket #144: deepamehta-init.patch
File deepamehta-init.patch, 2.9 KB (added by JuergeN, 13 years ago) |
---|
-
/etc/init.d/deepamehta
old new 88 88 # 0 if daemon has been started 89 89 # 1 if daemon was already running 90 90 # 2 if daemon could not be started 91 echo -n " Starting $DESC ... "91 echo -n "\n Starting $DESC ... " 92 92 status_of_daemon || ( [ "$?" = 1 ] && start-stop-daemon --start $EXTRA_ARGS --quiet --pidfile $PIDFILE --startas $DAEMON $DAEMON_ARGS ) 93 93 # Add code here, if necessary, that waits for the process to be ready 94 94 # to handle requests from services started subsequently which depend … … 97 97 # Sleep at least 8 seconds to check if deepamehta is running! 98 98 sleep 8 99 99 # 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 ) 101 101 } 102 102 103 103 # … … 110 110 # 1 if daemon was already stopped 111 111 # 2 if daemon could not be stopped 112 112 # other if a failure occurred 113 echo -n " Stopping $DESC ... "113 echo -n "\n Stopping $DESC ... " 114 114 status_of_daemon && start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE 115 115 RETVAL="$?" 116 status_of_daemon || echo "done. "116 status_of_daemon || echo "done.\n" 117 117 [ "$RETVAL" = 2 ] && return 2 118 118 # Wait for children to finish too if this is a daemon that forks 119 119 # and if the daemon is only ever run from this initscript. … … 145 145 case "$1" in 146 146 start) 147 147 [ "$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 ) 149 149 case "$?" in 150 150 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 151 151 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; … … 153 153 ;; 154 154 stop) 155 155 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" 156 status_of_daemon && do_stop156 status_of_daemon && ( do_stop; ( [ ! -z $LOG_DEEPAMEHTA_INIT ] && echo "$( date +%d.%m.%Y" "%H:%M:%S ) *** Stopping $DESC ***">>$LOG_DEEPAMEHTA_INIT ) ) 157 157 case "$?" in 158 158 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 159 159 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 160 160 esac 161 161 ;; 162 162 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" 164 164 ;; 165 165 restart|force-reload) 166 166 # … … 171 171 status_of_daemon && do_stop 172 172 case "$?" in 173 173 0|1) 174 do_start174 ( [ ! -z $LOG_DEEPAMEHTA_INIT ] && echo "\n$( date +%d.%m.%Y" "%H:%M:%S ) *** Restarting $DESC ***">>$LOG_DEEPAMEHTA_INIT ); do_start 175 175 case "$?" in 176 176 0) log_end_msg 0 ;; 177 177 1) log_end_msg 1 ;; # Old process is still running