Re: Print a message to all terminals at boot
On Thu, Mar 1, 2012 at 1:22 AM, Bob Proulx <bob@proulx.com> wrote:
> Tom H wrote:
>> Jason Heeris wrote:
>> >
>> > line (ttyS0) and the usual tty ones. I would like to print a message
>> > at the very end of the boot sequence, but before any user logs in (the
>> > message is a diagnostic that may affect whether the user logs in at all).
>>
>> If it's static, you can add it to "/etc/issue".
>
> Or if the process can update /etc/issue before getty can display it.
> The /etc/issue file could be updated many times and that should be
> okay. The contents are displayed when getting displays the login
> prompt. Meaning that when getting is started it will catch the
> current contents of /etc/issue at that moment. So updates need to be
> early in the boot cycle or getty needs to be held off until later in
> the boot cycle.
>
> I believe that if someone hits enter on the serial console that getty
> will print the current /etc/issue again. Meaning that a user could
> get the current value by hitting enter intentionally. But I can't
> recall if it does it before every login or only when it respawns after
> a timeout or several failed logins.
Interesting, thanks.
It gave me another idea for using dynamic data for "/etc/issue".
You can do the following in "/etc/rc.local":
cat <<EOF >/etc/issue
...\n...
$(ifconfig lo)
EOF
You can then do the same for "/etc/issue.net" (and set "Banner
/etc/issue.net" in "/etc/ssh/sshd_config") without the "...\n..." for
ssh logins.
Reply to: