Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A shell script to share Address Book data between users' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A shell script to share Address Book data between users
Authored by: readparse on Jun 16, '04 02:09:07PM
Interesting, although copying the address book back and forth seems like not the best way to share the data. It seems to me like a symlink is the way to go.

As a proof of concept, I just tried this on my machine. I copied the ~/Library/Application Support/AddressBook directory of my main user to /usr/local/PublicAddressBook (for lack of a better location and name) and then, for each user, after backing up their address book...

mv AddressBook AddressBook.backup

... then I created a symlink...

ln -s /usr/local/PublicAddressBook AddressBook

Boom, it works. Each user can read and write to the same data in real time. When one person updates the address, the next time the other person goes to that address, they see the latest info.

As for race conditions when both want to update at the same time... well, that probably means you've outgrown the default Address Book and need something designed for such a thing.

My only point here is that linking instead of copying is probably the way to go.

[ Reply to This | # ]

two possible buga-boos
Authored by: SOX on Jun 16, '04 02:58:01PM
Unless both of your users are Admin users, You will have to make sure both users share a group ID and that the file is writable by that group.

also one thing to watch out for is that the addressbook program may possibly delete and recreate the addressbook from time to time (as for example iTunes and iPhoto do with their databases). if so you will periodically have to restore the group priveledges.

[ Reply to This | # ]

Why not...
Authored by: Dale Mox on Jun 16, '04 03:54:29PM

Why not:
1) stick the database in the /Users/Shared folder (thus the name)
2) make a soft link to in from each user's folder
3) create a 'shareaddress' group in NetInfo and add the necessary users to it
4) set the file in /Users/Shared to that group

Then everybody can read it and edit it and so on...

Dale



[ Reply to This | # ]
Why not...
Authored by: readparse on Jun 16, '04 04:09:27PM

Yeah, that's a good idea. I should never post when I'm in a hurry, because I always leave stuff out. Like the permissions issue. I set the permissions on the PublicAddressBook to 777, which is certainly not the ideal way to do it.

I agree that there should be a group that has access to the global address book and those users needing access to it should be in that group.

The other difference is that I put in in /usr/local... /Users/Shared is a better idea.

Another thought... the best thing about a public address book is that it allows you to share those addresses while still being able to maintain private addresses of your own. So the idea solution to this would allow users to share an address group but not the entire book.

Food for thought.



[ Reply to This | # ]
Why not...
Authored by: readparse on Jun 16, '04 05:48:03PM

Yeah, that's a good idea. I should never post when I'm in a hurry, because I always leave stuff out. Like the permissions issue. I set the permissions on the PublicAddressBook to 777, which is certainly not the ideal way to do it.

I agree that there should be a group that has access to the global address book and those users needing access to it should be in that group.

The other difference is that I put in in /usr/local... /Users/Shared is a better idea.

Another thought... the best thing about a public address book is that it allows you to share those addresses while still being able to maintain private addresses of your own. So the idea solution to this would allow users to share an address group but not the entire book.

Food for thought.



[ Reply to This | # ]
A shell script to share Address Book data between users
Authored by: atter_cob on Feb 08, '05 03:04:23PM

I've noticed that the files keep getting larger and larger...

I have the addressbook shared between two machines. (The disk that the files are on is shared.) I've noticed that each time I access the file from one machine, it gets bigger even if I don't add anything.



[ Reply to This | # ]