Archives Under "mac" (RSS)
Setting up simple (sorta) daily backups on OS X
20 October 2006 | tech, mac, unix | 1 Response
You know, when people ask me
“Hey Aaron, how come you can walk through the world with such confidence and grace, always smiling, never ever ever sad?”
or
“Hey Aaron, I’m afraid all the time, but I notice that you aren’t ever scared of anything ever ever ever. What’s the secret to your fearlessness?”
my response is always the same: (cue the booming voice of amazingness)
“Well, friend, I can’t tell you how to become as great as me. But I can help you learn to regularly back up your files, which is the first step to becoming monster-awesomely unafraid and happy.” (end booming voice)
And here’s how you too can become monster-awesomely unafraid and happy:
Use RSync & Cron to do daily backups of your most important files
Today I lent out my usual backup solution (external hard-drive + silverkeeper) to a friend, so I had to figure out a new backup solution to use until he gives it back. I’ve experimented with rolling-my-own backups before (trying to use gmail as a backup server), but without much success. Until now. Today I rolled my very own set of backup scripts, and they’re working great. Here’s how I did it.
Strategizing
First, I thought for a while about what the heck I could back up to. Then it dawned on me: I have an outrageously good hosting plan on aaronpettigrew.com, so I can probably store it all here. Yippee! (For those who’d like to follow along: just modify these instructions to suit whatever backup destination is available. It should work fine.)
Using Rsync
Next, I started playing with rsync, a “[free] open source utility that provides fast incremental file transfer.” (Rsync is a unix app that comes installed on your mac, so no need to download it. Take note, though: if you’re running an OS earlier than 10.4 & you want to preserve resource forks, you might wanna install rsyncx.)
Rsync can be used either on the command line, or through the GUI (located in Applications/Utilities). The GUI is really cool & powerful. Try it out if you’re not interested in playing around with command line stuff. The ‘Quick RsyncX script generator’ is really great — you can set up your backup scheme, sources, destinations (including remote servers!) and some logic for the transfer. Then you can use the ‘Rsyncx scheduler’ to schedule your backups. Neat!
For me, the one thing the GUI lacked was the ability to allow me to easily specify paths to a variety of files/folders that I wanted to transfer all at once. So I went to the command line, where the options are a little more plentiful.
Using Rsync on the Command Line
To get my bearings using Rsync on the command line, I opened the terminal application (located in Applications => Utilities) and typed
man rsync
at the prompt. This brought me to the rsync manual, which is long and boring and really helpful and actually pretty well-written for a unix manual. I scoped out the syntax for using rsync, and decided that, since I was going to backup to a remote machine (but not an rsync server, whatever that is), I’d probably be using something like this:
rsync -[options] SOURCE USER@aaronpettigrew.com:DESTINATION_FOLDER
So, I tried it out, using a small folder of .rtf files as the source, and entering a command much like this one:
rsync -a ~/rsynctest USER@aaronpettigrew.com:rsyncbackups
It worked! Hoorah!
But since it’s not just file transfer I’m looking for, but an incremental backup, I tested a little further: I modified one of the files on my machine locally, then ran exactly the same command a second time. And Voila! When I checked on my server, only the file I’d modified had been re-uploaded; the rest stayed exactly the same. Yay!
Specifying the files/folders to back up
So, now that I had the basics working, I worked on figuring out how to specify only a given set of folders & files to backup. It’s a bit tricky, but I finally got it. Using the
–files-from=FILE
option, I learned that I can create a list of folders and files that Rsync will read for backup. Creating the file is really easy — enter
pico dailybackup_filelist
Then type the paths(without beginning slash) to the files & folders you want to backup, one per line. Hit ctrl x to exit, and type y at the prompt to save. Yay!
Since this is my daily backup (and not my weekly or monthly), I decided that I want to back up my Address Book, my Firefox Bookmarks, my work-related documents, and my calendars from iCal. I thought about adding mail in there too, but then I realized that it’s all backed up on Google’s servers, anyway, so no big deal. So I added the following lines to my file:
Library/Application Support/Firefox
Library/Application Support/AddressBook
Library/Application Support/iCal
Documents/workstuff
Now, here’s where it got tricky. Rsync’s usual archive option (-a), which provides exactly the kind of incremental backup I want, doesn’t recurse directories with the
–files-from=FILE
option, so I had to add the -r in there, so that I get all the contents of the directories I specified. (I also added the -z option, to use compression in transfer & the -v option, for verbosity, so I could see what’s happening during the transfer). The other tricky part is that rsync still requires a SOURCE argument in the command (which took me ages to figure out). It’s hard to explain what I mean, so here’s what my command ended up looking like (note — it’s all on one line):
rsync -razv –files-from=/Users/my_user_name/path_to_dailybackup_filelist /Users/my_user_name/ USER@aaronpettigrew.com:rsyncbackups
Now, I’ll explain:
rsync -razv
- rsync; (-r) search all the files and directories specified; (-a) perform an archival (or incremental) backup; (-z) use compression; and (-v) show me the output.
–files-from=/Users/my_user_name/path_to_dailybackup_filelist
- perform the rsync from the files and directories listed in the file /Users/my_user_name/path_to_dailybackup_filelist
/Users/my_user_name/
- search in the directory /Users/my_user_name/ for all the listed files and folders that I specified before.
USER@aaronpettigrew.com:rsyncbackups
- put my backups on aaronpettigrew.com, in the folder rsyncbackups.
Alright, we’re almost home.
Setting up Rsync through SSH
Before I could pack up this little script, I needed to figure out a way to get Rsync to communicate with my server without passwords, I had to go here to learn about SSH keys. SSH is a secure shell, useful for logging in to remote machines (like servers!). Rsync can use SSH to communicate with servers, which is handy because SSH supports a neat authentication scheme, where I can make a key-file that exists both on my machine and on the server, and SSH will simply match the key-files to authenticate, no need for a password. Neat!
Once I had my ssh key set up, I told Rsync to use SSH to connect to the server by adding
-e “ssh -2″
I tested it out, and Lo! it worked! No passwords!!
So now my whole command looks like this:
rsync -razv -e “ssh -2″ –files-from=/Users/my_user_name/path_to_dailybackup_filelist /Users/my_user_name/ USER@aaronpettigrew.com:rsyncbackups
Cronward!!
Scheduling via cron
Before I could actually set this up in cron, I decided to pack the command I’d made into a nice little script. Why? I dunno, it just seemed tidier. So, I opened pico again and entered
#! /bin/sh
on the first line, to tell the system that this is a script, and then I entered my command on the second line, just as I have it printed above. Then I saved the file as dailybackup.sh, and that was that!
For editing cron, I relied on the awesome O’Reilly tutorial that I found here. These instructions even taught me how to mail myself a message every time the script is run, so that I can know if anything went wrong. Neat! I tested the cron configuration a little before I decided on my final configuration. Here’s how my cronjob looks now:
17 22 * * * sh ~/dailybackup.sh 2>&1 | mail -s “Daily Backup Report” my_user_name
So at 22:17 every day, my computer will automatically backup my important files via dailybackup.sh, and then it’ll mail me a message about how that went. Yay!!
…And that’s how you too can become monster-awesomely unafraid and happy. Good luck!!
Maybe there *is* hope for wireless linux on my pb??
30 September 2006 | tech, mac | 2 Responses
So, it turns out I hadn’t quite fully given up on running Ubuntu after all. I found this thread on the Ubuntu support forums that discusses how to get the broadcom chipset (the brains behind Airport Extreme) to speak friendly-like with linux.
Here’s what’s happening, according to the thread:
The reason the card shows up but doesn’t work is because ubuntu is only distributed with its driver (so it can recognize it) not with its firmware (so it can USE it) for legal reasons. However you can take the firmware out of the windows drivers and put them into ubuntu and make the card work!
This inspired me to use the Ubuntu .iso I’d already burned (back when I was still excited) to boot as a live cd & see what I could get up to. It’s pretty cool to see my pb boot into linux again. Yee-Haw!
Most of the instructions for enabling my wireless card seemed to work, right up to the part where I have to reboot to see if I can connect. Because I’m using a live cd to boot, all changes I make get wiped on shutdown
So now I’m left with a decision to make: Do I keep going and re-partition my drive to install Ubuntu (which involves re-installing OSX, too) on the chance that my wireless card will work? Or do I stay quit and spend some quality time with, um, a book or something? What’s this worth to me?
I guess, now that the live cd is working, I’ll play around and see how Ubuntu stacks up. Then I’ll know if it’s worth the probable hassle.
![]()
Oh, and by the way, I’ve been writing this from firefox in Ubuntu (via an old ethernet cable). Yippee!
Ubuntu update: no wireless for my powerbook.
30 September 2006 | tech, mac | 2 Responses
Yerg again.
At least this time I didn’t get very far into my fantasy before I had to give up. One of the first articles I found about installing Ubuntu warned me that Airport Extreme (built into my powerbook) wouldn’t work, so I’d have no wireless access. Still, that article was a year and a half old, so things might have changed, right? No such luck. I checked out the Ubuntu user forums and confirmed that, as of 12 hours ago, the situation hasn’t changed.
The linux install is pretty useless to me without wireless (how could I maintain my café-going lifestyle?), so I’ve decided not to go ahead. Hopefully Airport Extreme support will get figured out at some point & I can join the fun. Until then, I guess it’s single boot for me…
Update: It does work after all. See this thread on the ubuntu forums for info on getting Ubuntu & Airport extreme to talk nicely.
technorati tags:ubuntu, wireless, powerbook
Ruby update: I’m giving up.
30 September 2006 | tech, mac | 1 Response
Yerg! I’ve been trying so hard to begin learning RoR, but I’m embarassed to say that I can’t even get it to install properly on my machine. It’s so bloody complicated & poorly documented (read: agile) that I’ve now fullly given up. I’m pretty used to frustratingly complex installation procedures — I am a drupal wonk, after all (yuk yuk). I’m patient, and I’m very comfortable with the command line, I swear I am. But this is just too much. I’ve spent at least 12 hours just installing Ruby, and it still doesn’t work.
Locomotive, the supposed RoR wonder-kid is no help (blasted SQLite & lightttpd, whatever you are!). Neither is the book “Agile Web Development with Rails”, which I, in my haste and desperate excitement, shelled out $60 to buy. Neither are the two articles I found for installing Rails piece by piece: this one & this one (the latter of which uses MacPorts, née DarwinPorts, which was at least kinda fun to revisit). In fact, nothing at all has helped, not even one bit. So I quit.
It’s sad — I really wanted to be one of those cool cool RoR guys that you see in the nice Vancouver cafés, sipping fancy whipped drinks & designing super-neat whizbang custom ajaxy CMSes and such. I really did. But alas, I guess I just won’t ever be one of them (or at least not until OSX 10.5 is released, with Rails included). Oh well. I’ll have to content myself to continue admiring them from afar.
It could be worse, I guess… I could be this guy.
Plus, there is a secret silver lining: while I was waiting for some piece of source code to compile fail, I looked up Ubuntu & discovered that there’s now (and maybe always was?) a PPC version of this most hallowed of linuxes. So I’m downloading that presently, with an eye toward converting my powerbook to a linux box (I have to do something to fight the urge to trade up to a macbook). I used to use linux, and I loved it. I think it’s time to give it a shot again. I only hope there’s fancy whipped drinks somewhere out there for linux kids, too. I really want some fancy whipped drinks right about now.
Apple Announces iTV (and a bunch of other stuff)
12 September 2006 | tech, mac | No Responses
Apple held a special press event today, announcing a bunch of new toys: redesigned (aluminum) iPod nanos (up to 8GB!), 80GB iPods (now with crappy games!), iTunes Video (a movie download service for mac!!), and, my favorite, a multi-media center called iTV. Here’s the specs from CrunchGear:
# Similar to Mac Mini, but 1/2 the size
# Features USB, ethernet, 802.11b/g, component video, optical audio and HDMI
# Uses apple remote
# Intended as a sort of ultimate media center, allows users to play movies, music, photos, etc. on TV
# Works with PC or Mac
# Price is $299 available in Q1 2007
CrunchGear » Blog Archive » It’s Showtime!
While this is all great news (and I love the aluminum redesigns!), the arrival of the iTV seriously complicates my quest to build a new media center in my home. Yerg!
technorati tags:Apple, iPod, iTV
Blogged with Flock
iPod gets a touch-screen?
5 September 2006 | tech, mac | No Responses
I stumbled upon this story on technorati today, suggesting that a touch-sensitive ipod is in the works. While I think that’s fun & neat & all, I didn’t get really excited until I watched this video of ‘multi-touch interaction experiments’ from Jeff Han.
I’ve often dreamed of touch-screen computing, particularly multi-touch video editing, but it’s always seemed a long way off. I know it’s been used a little — palm & treo make good use of it, as do POS systems in hoity-toity grocery stores, but it still hasn’t really been used creatively or to any great advantage in the normal everyday world of desktop computing.
Here’s my wishful thinking for the day: maybe (just maybe?) Apple’s new iPod, however small its ambitions, will help to usher in a new era of touchscreen technology that will tidy all our desktops & put more information at our fingertips.
Realistically, this stuff’s probably still a long way off. But a guy can dream, right?
