From 2a210d59e242b438f5f348ff9849e3ebd1a142a2 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 2 Dec 2011 14:47:48 +0100 Subject: [PATCH] rc: fix debug (console) and normal (file) logging in non multithreaded init mode --- etc/rc.d/init.d/rc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/etc/rc.d/init.d/rc b/etc/rc.d/init.d/rc index cbe4f7d..0e834ce 100755 --- a/etc/rc.d/init.d/rc +++ b/etc/rc.d/init.d/rc @@ -35,7 +35,10 @@ for cmd in $CMDLINE; do esac done -[ $debug -gt 0 ] && MAKEADD="DEBUG=1" +[ $debug -gt 0 ] && { + MAKEADD="DEBUG=1" + LOGFILE=/dev/console +} # set current (new) and previous runlevels runlevel=$1; export runlevel @@ -83,6 +86,10 @@ if [ "$previous" != "N" ]; then PROGRESS_BASE=${progressbase} \ ALLSERVICESNUM=$allservicesnum $MAKEADD else + [ $debug -eq 0 ] && { + LOGFILE=/var/log/initd.$runlevel.stop + > $LOGFILE + } i=0 for servicefile in `ls $rc_base/rc$runlevel.d/K* 2>/dev/null`; do check_link $servicefile && @@ -95,7 +102,7 @@ if [ "$previous" != "N" ]; then fi progress=`expr $progressbase + $i \* \( 100 - $progressbase \) / ${allservicesnum}` - $servicefile stop + $servicefile stop >> $LOGFILE i=`expr $i + 1` } done @@ -122,6 +129,10 @@ if [ "$multithread" = "1" ]; then sleep 1 done else + [ $debug -eq 0 ] && { + LOGFILE=/var/log/initd.$runlevel.start + > $LOGFILE + } i=0 for servicefile in `ls $rc_base/rc$runlevel.d/S* 2> /dev/null`; do check_link $servicefile || { i=`expr $i + 1`; continue; } @@ -135,7 +146,7 @@ else fi progress=`expr $progressbase + $i \* \( 100 - $progressbase \) / ${allservicesnum}` - $servicefile start + $servicefile start >> $LOGFILE i=`expr $i + 1` done fi