Backup your Mac with AppleScript

All programmers are lazy. They want to automate tasks as much as they can. Because of this uniquely great habit, they have developed countless of useful software.

Ok. I am lazy. I have been using rsync to sync folders I am working on between my Macs. I have been using command line scripts in Terminal for almost two years and finally I have gotten lazy over the task.

The thing is, I need to execute the scripts in Terminal every time I want to synch my folders. Of course, I could simply use cron to automate the tasks at specific time but I ran the risk to cause havoc between the folders on different Macs. It is best not to cron the task.

So, I learned up AppleScript and after a ten-minute hack, I wrote a nice AppleScripts to do the job. It is quick and dirty.

set debug to false

with timeout of (30 * 60) seconds
	tell application "Terminal"
		set Window_Title to "Sync Documents"
		set Rsync_Cmd to "rsync -acrtv --delete
			/Users/username/Documents/
			username@xxx:Documents"
		set output_doc to do shell script Rsync_Cmd
		choose from list paragraphs of output_doc with prompt
			"Result:" with title Window_Title with empty
			selection allowed
	end tell
end timeout

Copy the script to ~/Library/Scripts/Applications/Finder and save it as “sync documents.scpt”. Then launch Script Editor to edit username to your login name and xxx to your Mac IP address or computer name. This script will sync your Documents folder under your user home directory. To execute this AppleScript, at Finder, click on the script icon on the menu bar and select the script to launch.

rsync uses ssh. If you have not setup a password-less ssh login, you will need ssh-askpass in /usr/libexec. Unfortunately, it does not ship with Mac OS X. You can get it at Joe Mocker’s weblog.

Miranda

April 10th, 2009 at 20:42 · Filed Under Blogging, Computing, Days in My Life, Gadgets, Mac OS X, Technology · 1 Comment 

Finally, I have got an idea what name to give to my iPod Touch. It was named “Adrian Hoe’s iPod Touch” to make things simple. The hardest part was to find a name which implies its usefulness.

I have several reasons to buy an iPod Touch but I am not going to talk about them here. One most ostensible use of it is that I am no longer required to lug my MacBook (code-named Uranus) everywhere I go. Since it replaces the function of Uranus when it is not with me, I name my iPod Touch, Miranda, one of the five moons of Uranus. Miranda is the inner most and smallest moon of Uranus and is also referred to Uranus V.

When data is lost

April 10th, 2009 at 20:14 · Filed Under Blogging, Business, Computing, Marketing · Comment 

Almost all computer users have experienced data lost on their computers at least once in their life time. It is most frustrating when it happens while you are working on your project. You have so much data on your hard disk and worst, the project deadline is approaching. You suddenly plunge into despair. You lose your appetite and sleep. It is like the end of the world.

If you are running a business, your data lost can cause you a fortune. Data is the most valuable byproduct of any business. For example, customer database, sales and invoicing, stock inventory, etc.

There are numeral factors that can cause data lost. The most common are hard drive failure (electronic or mechanical), accidental deletion of file(s) or partition(s), accidental reformat of hard drive and OS failure. Fire and flood can also damage your hard disks. On advanced computing hardware, data lost can cause by the reasons mentioned earlier as well as RAID controller failure, rebuild RAID configuration failure, damaged or lost RAID configuration, corrupt or damaged partition table, etc. If you lose your data due to any of this or other reasons, you will need data recovery service.

If you are using a Mac, you need not to worry at all. The DataRecoveryGroup also provides Mac data recovery service to Mac users. They also provide server data recovery service to recover data from RAID disk arrays on servers.