rc: fix debug (console) and normal (file) logging in non multithreaded init mode

This commit is contained in:
Silvan Calarco 2011-12-02 14:47:48 +01:00
parent 9dd92f64e8
commit 2a210d59e2

View File

@ -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