MACSCRPT Archives

August 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 3 Aug 2007 21:59:25 +1000
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
Hi all,

I want to backup particular directories to an external hard disk each  
night. I want it to run without the need for anyone to login. It's a  
simple task to do in a shell script via ditto, and simple to initiate  
each night via cron or launchd.

Questions:

1. How can I check whether the external volume "Backup" is mounted,  
and conditionally execute the script (else mail to say there was an  
error). Simply checking whether /Volumes/Backup exists isn't reliable  
since there may be a directory created there (as I've seen created  
when the script runs with no disk attached).

2. How can I unmount the external Backup drive when the script is  
done, so it can be safely unpugged (FireWire)?

I currently have a rough script like this:

ditto -rsrcFork "/Shared Items/Web" /Volumes/Backup/Web
ditto -rsrcFork "/Shared Items/Mail" /Volumes/Backup/Mail
ditto -rsrcFork "/Shared Items/File Server" "/Volumes/Backup/File  
Server"
ditto -rsrcFork "/Shared Items/Databases/Databases Backup" "/Volumes/ 
Backup/Databases"

echo "Backup finished" | mail -s "Backup finished"  
[log in to unmask]

Thanks,
Tom

ATOM RSS1 RSS2