Like many people, I depend on SuperDuper (an award-winning backup utility) to make nightly backups of my Mac. I have it scheduled to run at 2:50 a.m., but in reality most of the time I run SD manually when I am finished for the day. I run a 'Smart Update,' and then have SuperDuper sleep my Powerbook.
This works great; in the morning, I can just pick up my PowerBook and head to the office. Except for one thing: the external FireWire drive is still attached. Sure I could just disconnect it, but do you want to see that dire message that appears when you disconnect a drive without unmounting it first? Me neither. The obvious solution: Tell SuperDuper to eject the drive when it is finished.
The problem: How? Simple. Write a small shell script to eject the drive and have SuperDuper run it after the copy and before the computer goes to sleep. Standard disclaimer: I've been using this successfully on a 15" PowerBook 1.5 GHz running 10.4.6 and SuperDuper 2.1 (v77). Use at your own risk, etc etc.
Here's what you need to to:
#!/bin/sh
/usr/sbin/diskutil eject /Volumes/BootBackup
exit 0
The #!/bin/sh line should be the first line.chmod 755 $HOME/bin/ejectBootBackup.sh
That just tells Mac OS X that the script is a program to be executed. Be sure to press Return after that line. You should not see anything in Terminal after you paste that line of text in. If you did, something must have gone wrong. If you change the name of the file to something else, make sure to change the chmod line, too!Mac OS X Hints
http://hints.macworld.com/article.php?story=20060511125715782