Timeline for Mac OS X "hosts" file, can I include other files with it?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 16, 2017 at 6:04 | answer | added | user728650 | timeline score: 0 | |
Feb 7, 2017 at 13:41 | answer | added | Campell | timeline score: 0 | |
Feb 13, 2012 at 21:52 | vote | accept | Lasse V. Karlsen | ||
Feb 13, 2012 at 21:52 | comment | added | Lasse V. Karlsen | @Karolos: I ended up writing a small script that concatenates several files into one hosts file, and then just empty out the relevant files before running it. | |
Feb 13, 2012 at 19:08 | comment | added | Karolos | @LasseV.Karlsen: Where you able to do what you wanted ? If yes, how did it succeed ? | |
Jan 22, 2012 at 19:35 | comment | added | Daniel Beck♦ | Let me know how it works, if you want to try doing it that way. Haven't tried it myself, so I don't post it as an answer. Good luck! | |
Jan 22, 2012 at 19:33 | comment | added | Karolos | @DanielBeck: Good point! I wasn't aware of all the capabilities of dscl. | |
Jan 22, 2012 at 18:39 | comment | added | Daniel Beck♦ |
See e.g. here. Internally, OS X uses its directory services, which you can control using dscl , for which /etc/hosts is simply one of the available data sources, providing (of course) hostname/IP address mappings. Setting up a script that writes to dscl and flushes the cache might work better in your situation than keeping multiple copies of the hosts file, or rewriting it all the time.
|
|
Jan 22, 2012 at 18:36 | comment | added | Lasse V. Karlsen |
I was not aware of the dscl command, I will have to research on that as well.
|
|
Jan 22, 2012 at 16:39 | comment | added | Daniel Beck♦ |
Are you sure you require changes to the hosts file as opposed to e.g. modifying the host entries via dscl directly?
|
|
Jan 22, 2012 at 14:36 | answer | added | Karolos | timeline score: 10 | |
Jan 22, 2012 at 13:07 | history | asked | Lasse V. Karlsen | CC BY-SA 3.0 |