FAQ
CentOS 7


How do I print something on the text-mode console right after the OS has
finished booting?


I've a virtual instance and I need to know its IP address after it has
finished booting up, to know where to ssh into it. I've tried adding "ip
-4 addr > /dev/tty0" to rc.local, but that obviously doesn't work,
because the login prompt overwrites everything I do.

Search Discussions

  • Frank Cox at Dec 8, 2014 at 11:47 pm

    On Mon, 08 Dec 2014 15:35:13 -0800 Florin Andrei wrote:


    How do I print something on the text-mode console right after the OS has
    finished booting?

    /etc/issue


    --
    MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
  • 谭志新 at Dec 9, 2014 at 12:56 am
    you can send a mail to your mailbox
    google Raspberry Pi mailip
    such as http://elinux.org/RPi_Email_IP_On_Boot_Debian


    for local network, there is no complicated steps to find the IP
    just get the hardware address of your card and scan the network with nmap.













    -----????-----
    ???: "Florin Andrei" <florin@andrei.myip.org>
    ????: 2014-12-09 07:35:13 (???)
    ???: "CentOS mailing list" <centos@centos.org>
    ??:
    ??: [CentOS] print something on console after boot

    CentOS 7

    How do I print something on the text-mode console right after the OS has
    finished booting?

    I've a virtual instance and I need to know its IP address after it has
    finished booting up, to know where to ssh into it. I've tried adding "ip
    -4 addr > /dev/tty0" to rc.local, but that obviously doesn't work,
    because the login prompt overwrites everything I do.

    --
    Florin Andrei
    http://florin.myip.org/

    _______________________________________________
    CentOS mailing list
    CentOS at centos.org
    http://lists.centos.org/mailman/listinfo/centos



    --
    ?????????????
    ???????303? 518060
    ???18948323721 ??
    ???0755-26538886
    ??: 0755-26534656
  • Dan Hyatt at Dec 10, 2014 at 8:47 pm
    I might be in left field but...


    in init.d create a script that simply


    echo_ip


    script contents
    #!/bin/bash
    ip -4 addr |grep inet |tee /var/log/ip # this will only print the ip
    lines and copy to /var/log/ip ( I prefer tee over echo, for a variety of
    reasons)






    then create S99echo_ip in rc3.d
    so that it runs last










    then On 12/8/2014 5:35 PM, Florin Andrei wrote:
    CentOS 7

    How do I print something on the text-mode console right after the OS
    has finished booting?

    I've a virtual instance and I need to know its IP address after it has
    finished booting up, to know where to ssh into it. I've tried adding
    "ip -4 addr > /dev/tty0" to rc.local, but that obviously doesn't work,
    because the login prompt overwrites everything I do.
  • Gordon Messmer at Dec 10, 2014 at 10:51 pm

    On 12/10/2014 12:47 PM, Dan Hyatt wrote:
    I've a virtual instance and I need to know its IP address after it has
    finished booting up, to know where to ssh into it. I've tried adding
    "ip -4 addr > /dev/tty0" to rc.local, but that obviously doesn't work,
    because the login prompt overwrites everything I do.

    The easy answer would be: don't fight the login prompt. "agetty" writes
    the contents of /etc/issue to the console before the login prompt. If
    /etc/issue contains "\4" then agetty will print the IPv4 address to the
    console.


    See the man page for agetty, and update /etc/issue.
  • James B. Byrne at Dec 11, 2014 at 2:30 pm

    On Wed, December 10, 2014 17:51, Gordon Messmer wrote:
    On 12/10/2014 12:47 PM, Dan Hyatt wrote:
    I've a virtual instance and I need to know its IP address after it has
    finished booting up, to know where to ssh into it. I've tried adding
    "ip -4 addr > /dev/tty0" to rc.local, but that obviously doesn't work,
    because the login prompt overwrites everything I do.
    The easy answer would be: don't fight the login prompt. "agetty" writes
    the contents of /etc/issue to the console before the login prompt. If
    /etc/issue contains "\4" then agetty will print the IPv4 address to the
    console.

    See the man page for agetty, and update /etc/issue.

    I find that CentOS-6 evidently does not support \; nor many of the /etc/issue
    flags defined in man 1 agetty:


    /etc/issue
    CentOS release 6.6 (Final)
    Kernel \r on an \m


    Test: b:\b d:\d s:\s l:\l m:\m n:\n o:\o O:\O r:\r t:\t u:\u 0:\0 4:\4 6:\6




    login:


    CentOS release 6.6 (Final)
    Kernel 2.6.32-504.1.3.el6.centos.plus.x86_64 on an x86_64


    Test: b: d:09:19 on Thursday, 11 December 2014 s:Linux l:7 m:x86_64
    n:vhost04.hamilton.harte-lyne.ca o: O: r:2.6.32-504.1.3.el6.centos.plus.x86_64
    t:09:19 on Thursday, 11 December 2014 u: 0: 4: 6:


    For ease in analysis (note that flags \0, \4, and \6 are not defined in agetty):


    b:
    d:09:19 on Thursday, 11 December 2014
    s:Linux
    l:7
    m:x86_64
    n:vhost04.hamilton.harte-lyne.ca
    o:
    O:
    r:2.6.32-504.1.3.el6.centos.plus.x86_64
    t:09:19 on Thursday, 11 December 2014
    u:
    0:
    4:
    6:


    Is there some configuration issue of which I am unaware? Where is the flag \4
    usage defined?


    --
    *** E-Mail is NOT a SECURE channel ***
    James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
    Harte & Lyne Limited http://www.harte-lyne.ca
    9 Brockley Drive vox: +1 905 561 1241
    Hamilton, Ontario fax: +1 905 561 0757
    Canada L8E 3C3
  • Kahlil Hodgson at Dec 11, 2014 at 11:30 pm
    Looks like you are seeing the codes defined for mingetty rather than
    agetty. This is what you would expect for a virtual console on CentOS 6
    which uses the former.


    K
    ?al?

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedDec 8, '14 at 11:35p
activeDec 11, '14 at 11:30p
posts7
users7
websitecentos.org
irc#centos

People

Translate

site design / logo © 2021 Grokbase