Automatically Update Host Files across several machines on a network (OS X)
Other *NIXThis forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Automatically Update Host Files across several machines on a network (OS X)
Hi,
I have a question for all you networking type out there. What I have here is a company with about 15 Macintosh computers running anything from OS X 10.4 to OS X 10.6. Our main MAMP server runs OS X 10.5. We even have a few WIN XP machines floating around.
Here is what I'm attempting to do (I'll explain to the best of my ability).
Whenever we create a new site, we have to add the entry to the host file on the server. So what I would like to essentially accomplish is to somehow automatically update ALL host files in the building with the new instance so EVERYONE can view the dev site.
Does anyone have a script that does this? I'm not really the networking type but I was put in charge of this task. I'm kinda stuck here and not even sure really where to begin so any help would be beneficial at this point. It's very simple to update ONE host file but 15+ every day if not automated could become quite the chore.
Have a look at Unison File Synchronizer. I use it just for such a purpose as you describe. Several configuration files on a server change frequently in our environment and to avoid having to change them all, I installed Unison so our dev guys only have to change the file(s) in one location and within a minute the file gets synchronized to all other servers. Unison is available for various OS, so that also takes the variety in operating systems you might have.
I hope it works for you like it does for me. Please keep us up to date on your progress and whatever problems/questions you might have, you can post them here. I'm sure someone will provide an answer.
Now try synchronizing a.tmp and b.tmp. (Since they are identical, synchronizing them won't propagate any changes, but Unison will remember the current state of both directories so that it will be able to tell next time what has changed.) Type:
unison a.tmp b.tmp
Reading the above, I would assume it would work but I keep seeing this message and no changes occur.
2010-08-24 15:37:48.464 Unison[5647:f07] *** __NSAutoreleaseNoPool(): Object 0x20a3e0 of class NSThread autoreleased with no pool in place - just leaking
2010-08-24 15:37:48.484 Unison[5647:f07] Unknown class MessageProgressIndicator in Interface Builder file at path /Applications/Unison.app/Contents/Resources/English.lproj/MainMenu.nib.
2010-08-24 15:37:48.560 Unison[5647:f07] *** WARNING: Method selectRow:byExtendingSelection: in class ProfileTableView is deprecated. It will be removed in a future release and should no longer be used.
I created a few files after I ran that command in a.temp and waited a bit and nothing happened so I ran the unison command again and still got that message.
I've never had that error and it doesn't ring any bells. Can you check your permissions on the directory where you are executing the command from? When Unison is ran for the first time it should display a particular message telling so and after confirmation from you, Unison will create a .unison directory where it will hold its archive files. You can also check the Unison settings using:
Code:
unison -debug all
and see if that shows anything strange.
I assume you're running on Linux, if not, then did you download the appropriate version of Unison for your OS?
Hi Eric,
No I'm running this on OS X 10.6. I ran the GUI tool and that syncs perfectly in the same directory. All permissions are set to read/write. I guess I'm not sure why the command utility is doing this.
Here is what unison -debug all returns. Not real sure what this means but it doesn't look good. This is the latest stable release of 2.27.72.
pc64:~ developer2$ unison -debug all
2010-08-25 08:26:04.651 Unison[8010:f07] *** __NSAutoreleaseNoPool(): Object 0x20a3e0 of class NSThread autoreleased with no pool in place - just leaking
2010-08-25 08:26:04.695 Unison[8010:f07] Unknown class MessageProgressIndicator in Interface Builder file at path /Applications/Unison.app/Contents/Resources/English.lproj/MainMenu.nib.
2010-08-25 08:26:04.767 Unison[8010:f07] *** WARNING: Method selectRow:byExtendingSelection: in class ProfileTableView is deprecated. It will be removed in a future release and should no longer be used.
Ok scratch that last one. I got it working. The message still comes up but if I call unison profilename from terminal it works just fine . One other question though, I'm now attempting to set up profiles using ssh. What goes in the host field? I have a machine across the room I'm testing on first. Would I use the machine's IP address for the host?
Last edited by filterfann; 08-25-2010 at 02:58 PM.
Ok,
Now the issue has shifted from a Unison issue to an ssh issue. When I attempt to ssh to the respective computer it says
ssh: connect to host 192.168.1.54 port 22: Connection refused. Once I figure this out, I can properly configure the unison profile to sync these host files. I also have a concern about the directory on OS X and Windows as far as permissions are concerned. Hopefully the su command will work for this but I'm not sure if ssh for XP has the super user (su) command.
How would I go about explicitly forcing it to use an open port? Do most firewalls block port 22 by default for security?
Ok scratch that last one. I got it working. The message still comes up but if I call unison profilename from terminal it works just fine . One other question though, I'm now attempting to set up profiles using ssh. What goes in the host field? I have a machine across the room I'm testing on first. Would I use the machine's IP address for the host?
Hi,
You can use either if your system is set up correctly. For example if you don't have a DNS server in your LAN that can resolve a hostname, you can put the IP hostname combination in the hosts file. I believe that also exists on a Mac (I have no experience with Mac whatsoever, so just guessing). Normally any system is configured to first look at the hosts file if I'm correct and next turn to DNS.
Not sure but the message that comes up might just be specific to the Mac version. It looks like a class or library being called for the GUI while you're running it from terminal.
Ok,
Now the issue has shifted from a Unison issue to an ssh issue. When I attempt to ssh to the respective computer it says
ssh: connect to host 192.168.1.54 port 22: Connection refused. Once I figure this out, I can properly configure the unison profile to sync these host files. I also have a concern about the directory on OS X and Windows as far as permissions are concerned. Hopefully the su command will work for this but I'm not sure if ssh for XP has the super user (su) command.
How would I go about explicitly forcing it to use an open port? Do most firewalls block port 22 by default for security?
Hello,
Once you have a SSH session opened you can run any command as if you were logged in on the terminal of the computer itself. SSH just opens a tunnel to a terminal on a remote system.
If you cannot connect to the SSH server, check if you have the SSH daemon listening on the correct IP/port combination. I'm not sure for Mac how it works but in Linux you'd need to edit the sshd_config file in /etc/ssh/.
If your two test systems are in the same LAN then it shouldn't be a firewall problem unless you have a firewall setup on your system that has the SSH server installed (Mac?).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.