Address Book Backup

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Address Book Backup Sun Feb 27, 2011 2:00 pm • by smarsh
Hi all,

I'm having trouble getting the following to work, where I am looking at get Hazel to create a back up of my address book each day. I'm doing the following (pointing Hazel at the relevant backup folder):

If all:
1. Date added is before Today
2. Name is Address Book

Do the following:
3. Run shell Script
4. Embedded script:
Code: Select all
filedate=`/bin/date "+%Y-%m-%d"`
cp -R "/Users/Username/Library/Application Support/AddressBook" "/Users/Username/Backups/Address Book Backup/Address Book $filedate.abbu"

(where username is my username obviously).

What am I doing wrong? (the shell script works in terminal fine but doesn't seem to work in Hazel)...
smarsh
 
Posts: 2
Joined: Sun Feb 27, 2011 1:51 pm

Re: Address Book Backup Sun Feb 27, 2011 5:01 pm • by sjk
Any reason not to do this with cron or launchd?
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Address Book Backup Sun Feb 27, 2011 5:32 pm • by smarsh
No idea how to do that - is it through an app like Lingon or can you do it through Hazel?

What's the advantages of using Launchd?
smarsh
 
Posts: 2
Joined: Sun Feb 27, 2011 1:51 pm

Re: Address Book Backup Sun Feb 27, 2011 6:19 pm • by sjk
Lingon is a GUI app for configuring launchd.

At least for me an advantage of using cron or launchd (or even iCal) would be more easily scheduling when a daily backup runs than with Hazel. Plenty of info on the web how to run a script with both, e.g.:

Scheduling, Cron & Launchd « Clark's Tech Blog

Hazel rules are triggered by file changes that may or may not occur when you expect/want them to. Other methods let you choose specific times.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Address Book Backup Mon Feb 28, 2011 1:09 pm • by Mr_Noodle
Using Lingon may make more sense in this case. That said, it seems having Hazel monitoring the back up folder makes no sense. You are saying that you want Hazel to run the script to create a backup every time a new backup file appears? It seems like a chicken and egg problem there. I'm guessing what you really want is to check the modified time on the original address book file.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Address Book Backup Tue Mar 01, 2011 12:23 pm • by sjk
Mr_Noodle wrote:I'm guessing what you really want is to check the modified time on the original address book file.

But ~/Library/Application Support/AddressBook is a folder and its modtime and some files contained in it will be updated even if no explicit changes are made. It's not obvious to me exactly which file/folder Hazel would monitor to trigger an AB backup; maybe AddressBook-v22.abcddb inside the folder?
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Address Book Backup Fri Mar 04, 2011 3:50 pm • by Mr_Noodle
Not sure how Address Book works but it would seem that the .adcddb file is the one to watch. Nonetheless, as already mentioned, if it's scheduled, then cron/launchd/Lingon may be a better option.

Note that there will (hopefully) be some scheduling support in Hazel in 3.0.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Address Book Backup Fri Mar 04, 2011 7:38 pm • by sjk
Mr_Noodle wrote:Note that there will (hopefully) be some scheduling support in Hazel in 3.0.

Neat; thanks for that teaser. :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene


Return to Support