LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   [OpenBSD] change myname w/o restarting box (https://www.linuxquestions.org/questions/%2Absd-17/%5Bopenbsd%5D-change-myname-w-o-restarting-box-516989/)

noir911 01-06-2007 05:24 PM

[OpenBSD] change myname w/o restarting box
 
I changed the host name in "/etc/myname" but the change would not take effect unless and until I restart the box as this file is read by netstart(1) during startup.

Is there any way to get the change take effect without rebooting the box?

frob23 01-06-2007 05:40 PM

As root:
Code:

hostname `cat /etc/myname`
You may need to log-out and back in, to see it in your prompt (if you have it set as part of your prompt)... but that command will change it. You don't "need" to log-out, I personally have it as part of my prompt and usually want that accurate so I will.

It's actually the command run by the netstart script to set it in the first place.

chort 01-07-2007 01:56 AM

Hmm, it's possible that
Code:

# sh /etc/netstart if0
could work too. What frob23 posted works absolutely fine, but re-running netstart for your particular device helps out in other cases where you edit your /etc/hostname.if0 file and want to apply the changes without necessarily doing all the steps with ifconfig, etc.


All times are GMT -5. The time now is 01:21 AM.