LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This 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


Reply
  Search this Thread
Old 08-17-2010, 08:24 AM   #1
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Rep: Reputation: 15
Smile 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.

Thanks in advance!
 
Old 08-18-2010, 01:02 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

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.

Kind regards,

Eric
 
Old 08-19-2010, 01:30 PM   #3
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
Wow,
Thanks Eric!!!! I'll look into this further!!
 
Old 08-19-2010, 01:54 PM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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.

Kind regards,

Eric
 
Old 08-24-2010, 03:40 PM   #5
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
Unison Issues

Ok I started testing Unison locally for now using this tutorial

http://www.cis.upenn.edu/~bcpierce/u...ual.html#local

Create a small test directory a.tmp containing a couple of files and/or subdirectories, e.g.,

mkdir a.tmp
touch a.tmp/a a.tmp/b
mkdir a.tmp/d
touch a.tmp/d/f

Copy this directory to b.tmp:

cp -r a.tmp b.tmp

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.

Am I missing something?
 
Old 08-24-2010, 03:43 PM   #6
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
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.
 
Old 08-25-2010, 01:01 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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?

Kind regards,

Eric
 
Old 08-25-2010, 08:33 AM   #8
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
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.

Thanks
 
Old 08-25-2010, 02:55 PM   #9
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
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.
 
Old 08-25-2010, 04:51 PM   #10
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
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?
 
Old 08-26-2010, 12:42 AM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by filterfann View Post
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.

Kind regards,

Eric

Last edited by EricTRA; 08-26-2010 at 12:44 AM.
 
Old 08-26-2010, 12:55 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by filterfann View Post
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?).

Kind regards,

Eric
 
Old 08-26-2010, 09:11 AM   #13
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
Ssh is working, but now I get this error when running my profile

Fatal Error
Uncaught exception: Unix error(Bad file descriptor,write,)

Could this be a permissions thing? Right now I'm just testing with a .txt file on the remote machine.
 
Old 08-26-2010, 09:15 AM   #14
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
Here is what my profile looks like just in case

# Unison preferences file
root = Users/Developer2/Desktop/test.txt
root = ssh://Graphics3@192.168.1.54/Users/Graphics3/Desktop/test.txt
 
Old 08-26-2010, 02:10 PM   #15
filterfann
Member
 
Registered: Dec 2005
Posts: 61

Original Poster
Rep: Reputation: 15
also occasionally getting this one too

Uncaught exception: Fatal error: Lost connection with the server

even though I have another active ssh connection open in another terminal window.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resolving windows machines automatically. Palula Linux - Software 2 03-31-2008 02:51 PM
how to automatically synchronize files on different machines? parv Linux - Software 7 02-03-2007 10:31 AM
Need help setting up the Host & network files. hitbob Linux - Networking 4 08-22-2003 03:45 AM
Update network install files UKnewWho Linux - Newbie 0 08-10-2003 10:08 PM
Automatically mounting to other machines ankitgdit Linux - Security 1 08-08-2003 10:08 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 11:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration