OpenWrt Forum Archive

Topic: backgrounded' logger in rcS

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hopefully someone of you can enlighten me:

In this section

for i in /etc/init.d/S*; do
  $i start 2>&1
done | logger -s -p 6 -t '' &

rcS will loop through the init-scripts and the

logger -s -p 6 -t '' &

is used to log the output created by the individual scripts to the syslog.

After all init-scripts are executed there will be no more work for this logger process so it is safe to
a) kill it afterwards (or better)
b) start it without the &

Is there an error in reasoning by myself or why gets the logger process backgrounded'?

wbr luki-

luki- wrote:

Hopefully someone of you can enlighten me:

In this section

for i in /etc/init.d/S*; do
  $i start 2>&1
done | logger -s -p 6 -t '' &

rcS will loop through the init-scripts and the

logger -s -p 6 -t '' &

is used to log the output created by the individual scripts to the syslog.

After all init-scripts are executed there will be no more work for this logger process so it is safe to
a) kill it afterwards (or better)
b) start it without the &

The process should terminate as soon as all S* scripts have been executed : its standard input is then closed and in this case, logger just terminates (like if you do echo blah | logger).

luki- wrote:

Is there an error in reasoning by myself or why gets the logger process backgrounded'?

The process is started in background to allow you to get a shell on the serial console as soon as possible. init spawns process from /etc/inittab only when rcS is done.

Vincent Bernat wrote:

The process should terminate as soon as all S* scripts have been executed : its standard input is then closed and in this case, logger just terminates (like if you do echo blah | logger).

'should'  - but it is keeps running (sleeping state), therefore i was wondering about.

Vincent Bernat wrote:

The process is started in background to allow you to get a shell on the serial console as soon as possible. init spawns process from /etc/inittab only when rcS is done.

& makes sense now. thanks wink

luki- wrote:
Vincent Bernat wrote:

The process should terminate as soon as all S* scripts have been executed : its standard input is then closed and in this case, logger just terminates (like if you do echo blah | logger).

'should'  - but it is keeps running (sleeping state), therefore i was wondering about.

In which case there's something in your init scripts which is keeping stdout (logger's stdin) open; not that it really matters.

The discussion might have continued from here.