diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-06-03 12:48:57 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-06-03 12:48:57 (EDT) |
commit | 260215db14c3f6f60b1e080e22706eb3a5e4b90b (patch) | |
tree | c702a5d0fba37aa195e69a8e3d8c5ff044ada568 | |
parent | 0a044bae97fbbd9c0a18d8016cdc863297fbf07e (diff) |
/etc/init.d/rc: Buffer output until syslogd runs.
-rwxr-xr-x | src.etc/init.d/rc | 20 |
1 files changed, 19 insertions, 1 deletions
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 |