Find the answer to your Linux question:
Results 1 to 4 of 4
Okay: here is what I want my Mandrake to do. On bootup, I want it to read from the /etc/hostname file, and set the hostname accordingly. If I put "#hostname ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2003
    Posts
    12

    Hostname


    Okay: here is what I want my Mandrake to do. On bootup, I want it to read from the /etc/hostname file, and set the hostname accordingly. If I put "#hostname foo" in rc.local my hostname will be foo, but it is run after KDM has started. So KDM will show up dhcppc2, instead of foo, until i restart X server. When I boot up, I want to see "Welcome to foo". Here is a line of my rc.sysinit file:

    HOSTNAME='/usr/bin/hostname'
    That is where it's being set to dhcpp2. How can I get it to read from the first line of /etc/hostname? Or is there something else I can do?



    PS: This isn't a big problem; I just want to know how to solve this. It's really boterhing me

  2. #2
    Just Joined!
    Join Date
    Nov 2003
    Posts
    12
    I can get it to work by setting the default runlevel in inittab to 3, and then in rc.local have a
    hostname $(cat < /etc/hostname)
    init 5

    but its a lot slower, CUPS and other daemons usually initilize while KDM is being brought up.

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'm guessing that you get the dhcppc2 hostname when aquiring an address over DHCP, right? In that case, I think the best way would be to find a way to make the DHCP client daemon leave the hostname alone. Most DHCP client daemon have an option to do just that. I don't know what DHCP client daemon Mdk uses, though, so I can't answer that explicitly. Looking at the manpage should yield the answer, though.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Nov 2003
    Posts
    12
    thanks a lot! i turned GETHOSTNAME to no, and ti works great! thanks man!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •