From 260215db14c3f6f60b1e080e22706eb3a5e4b90b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 03 Jun 2014 12:48:57 -0400 Subject: /etc/init.d/rc: Buffer output until syslogd runs. --- diff --git a/src.etc/init.d/rc b/src.etc/init.d/rc index 0c81e9e..6747dd0 100755 --- a/src.etc/init.d/rc +++ b/src.etc/init.d/rc @@ -7,8 +7,26 @@ # This file may be reproduced, distributed, modified, and otherwise dealt in # under the terms of the Expat/MIT License. +LF=' +' + [ -x /usr/bin/logger ] && logger='logger -p 6 -t sysinit' || logger=cat +# Buffer log lines until syslogd is running. +log() +{ + local line= + local buf= + + while read -r line; do + buf="${buf}${line}${LF}" + if [ -f /var/run/syslogd.pid ]; then + printf '%s' "${buf}" | ${logger} + exec ${logger} + fi + done +} + level=${0#*/rc} case ${level} in S) @@ -29,4 +47,4 @@ esac for i in /etc/rc.d/${level}[2-9]*; do [ -x "${i}" ] && "${i}" ${action} 2>&1 done -} | ${logger} +} | log -- cgit v0.9.1