Mount drive on Xserve and backup files

Hi gang. I am just starting to investigate attempting the following.

I’d like to devise an applescript that launches daily at a prescribed time on an Xserve, mounts an internal drive, copies specified folders and files from the boot drive to the newly mounted drive, and upon completion unmounts the drive again.

:?: Anyone have any idea how I would even go about this? The majority of my scripting experience has been in OS9 and involving graphics applications. This would be the first for this type of scenario.

Any help and direction would be greatly appreciated!

As much as I’d like to offer an AppleScript to do this, what you want is FAR easier achieved with a simple shell script, not AppleScript.

For a start, AppleScript, by itself can not mount drives or copy files - it relies on other applications or Scripting Additions to do its work. In this case you would probably use the Finder to mount and copy the files but, especially since this is a server, you can’t be sure the Finder is running.

Instead, the following shell script will do what you want. Save it on disk and add a line to your crontab to have it executed automatically at whatever time schedule you like.

#! /bin/sh

# mount the drive
mount server:/mount/point /mnt

# copy the files - man cp to find what cp flags are appropriate for your needs
# repeat as appropriate
cp /path/to/original/file /mnt

# and umount when done
umount /mnt

Admittedly this script is bare boned - no error checking, etc., but it demonstrates the point.

Also, if you truly wanted an AppleScript solution, you could wrap this all in a ‘do shell script’ handler, but that seems pointless.