PDA

View Full Version : How to stop message display at shutdown ??



mik93
3rd December 2007, 02:58 PM
Somewhere in the past I've seen that I can stop the display of messages to the screen during shutdown.

can someone please remind me of the key combination

also:
can this be set as a default somewhere ?

Mike

mik93
3rd December 2007, 10:28 PM
Does this lack of replies mean that no one else cares about the long list of "OK"s as each service is shut down ?

I'm certain that there is a way of setting the display level to 1, or 2, or 3 . . . . etc

Mike

marko
3rd December 2007, 11:02 PM
Not really, you can put a test into the "echo_success" function in the
/etc/init.d/functions file so that if a variable of your own invention,
like "FAILUREONLY", is "on" (put that in file /etc/sysconfig/init), then the "OK" is
not echoed to the screen. The problem is that each init script in /etc/init.d
has it's own echo call to say "Shutting down $prog:" like this copy and pasted
from ntpd:

stop() {
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}

so all that you've gotten
rid of is the "OK" but you still see each daemon or whatever say it's Shutting down
or Starting. To silence that entirely you'd have to change all the scripts.
The better way would be to make "start()" and stop() be generic functions
in the functions file and just have the test for "FAILUREONLY"'s value
be in those two places but the problem is there are always minor differences in
what each script needs stop and start to do (some need a particular nice setting, etc)
so you can't do that.

Mark

mik93
3rd December 2007, 11:52 PM
Thanks for that - tho it looks too complicated to be useful to me.

I am <certain> that at some time in the past (sort of RH9 days) I have used a shortcut to turn them off

Mike.

mik93
4th December 2007, 02:08 PM
If I can't easily stop the messages is it possible to redirect them to a file instead of the screen ?

Note: Saw the same question recently in the context of F7. The boot gui in Fedora 8 has the option to show or hide messages. It seems obvious that the same should be available for shutdown after the last gui is closed :(

Mike

marko
5th December 2007, 05:17 AM
Mike
This isn't a perfect way to do this but you could edit this line in /etc/inittab:

l6:6:wait:/etc/rc.d/rc 6

to look like this:

l6:6:wait:/etc/rc.d/rc 6 > /dev/null 2>&1


This is because shutdown is really Linux going from runlevel N to 6,
(N is usually 3 or 5) so my change only affects shutdown/reboot.
init takes the entire string to the right of the "wait:" as being the
command line it should run to go to runlevel 6. So this tricks it into running

/etc/rc.d/rc 6 > /dev/null 2>&1

instead of

/etc/rc.d/rc 6

NOTE that this hides all the console output from all the
rc6 scripts. So if an error happens you'll miss it along with
all the "OK/Successful" messages. This is the big negative with
this, so it's not a great solution. Another option would be to
make the redirection go to a real disk file, then at least if
something weird happens you can look at the file:

/etc/rc.d/rc 6 > /var/log/hideinit.log 2>&1

Note this wipes the file each time so it doesn't bloat up,
do an append if you want with ">>" instead of my ">"

If you find the actual built-in way
to hide those please post it. You might also still see a few messages
like one or two that come from init directly, those aren't stopped
by the redirection.

Mark

mik93
5th December 2007, 09:06 PM
Many thanks Marko.
Works exactly as you said it would (of course).

Only message showing for about 20 secs on a black screen during a reboot was "system is restarting". :)

Mike

mik93
6th December 2007, 08:54 PM
Mark
After a recheck I find that this only works on REBOOT
/etc/rc.d/rc 6 > /var/log/hideinit.log 2>&1

> Logical because level 6 = reboot

Now added
/etc/rc.d/rc 0 > /var/log/hideinit0.log 2>&1

Checked that the supression now works at shutdown too.

Thanks for the pointer
Mik

hiberphoptik
6th December 2007, 09:12 PM
people shut down their linux machines????

:)

seriously tho.. what if something is broken and you cant see that its broke because the message are not displayed?

mik93
7th December 2007, 01:22 PM
People have problems on Linux machiines ????? !!!!!

Seriously tho.
I don't normally get problems. When I do its very rare to have a problem that stops me rebooting. The pipe to file cmd in inittab stores the status. As Mark said, by changing the pipe command to >> you can append all the shutdown messages if you have the space or need.

marko
7th December 2007, 03:30 PM
You could also try:


l0:0:wait:/etc/rc.d/rc 0 | /bin/grep "FAILED"
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6 | /bin/grep "FAILED"

since the failure mode displays "FAILED" and the normal/good result is "OK"
this would still show the failures but ignore the successes.

Mark

mik93
7th December 2007, 09:04 PM
Thanks Mark - I'll give it a go.

I found the key combo I was thinking of:
(from kernelbook.sourceforge.net/pdf/ch-sources.pdf)
quote . .
<Alt>SysRq><digit> The digit is '0' to '9'. Set the console log level, controlling which kernel messages will be printed to your console. For example, '0' will cause only emergency messages like PANICs or OOPSes displayed on your console.
Not sure if the alt and sysrq need 2 B held down at the same time as the digit - haven't tried it since Mark's more permanent solution.

MIke