Automated Backups with AppleScript in Mac OS 9
Mac OS 9 relies on the Classic Mac OS architecture, which lacks modern Unix utilities like cron or launchd for task scheduling. However, users can build reliable, automated backup workflows by leveraging AppleScript’s deep integration with the Mac OS 9 Finder, third-party scriptable applications, and system scheduling tools. This article outlines the primary automated backup workflows possible in Mac OS 9 using AppleScript, covering local duplication, networked transfers, archive compression, and execution triggers.
Scheduled Local Folder Synchronization
The most straightforward backup workflow involves copying critical user directories to a secondary local volume, such as a secondary internal hard drive, a FireWire drive, or removable media like an Iomega Zip or Jaz disk.
Using AppleScript, the script targets the Finder to duplicate folders using classic colon-delimited paths:
tell application "Finder"
set sourceFolder to folder "Macintosh HD:Documents:Work:"
set targetFolder to folder "Backup Drive:Daily Backups:"
duplicate sourceFolder to targetFolder with replacing
end tell
This workflow safely replaces older files while preserving Mac OS resource forks and type/creator metadata, which standard non-native transfer tools often strip away.
Automated Network Backups via AppleShare (AFP)
In mixed or networked environments, Mac OS 9 can automate backups to a central server or another Mac over AppleTalk or TCP/IP.
AppleScript automates this workflow in three steps:
- Mounting the Network Volume: The script uses the
mount volumecommand to connect to an AppleShare server using embedded credentials or guest access. - Transferring Files: The script instructs the Finder to copy priority data to the mounted volume.
- Ejecting the Volume: The volume is cleanly unmounted to reduce network vulnerability.
mount volume "afp://backupuser:password@192.168.1.50/Backups"
tell application "Finder"
duplicate folder "Macintosh HD:Documents:" to folder "Backups:Mac9_Archive:" with replacing
eject disk "Backups"
end tell
Compressed Archiving via StuffIt Deluxe
Storage capacity on vintage hardware is often limited. Workflows can integrate compression tools like Aladdin Systems' StuffIt Deluxe or DropStuff, which feature robust AppleScript dictionaries.
Instead of raw file copying, the script instructs StuffIt to create a
compressed, dated .sit archive directly to the backup
destination:
set currentDate to (current date) as text
set archiveName to "Backup_" & currentDate & ".sit"
tell application "DropStuff"
stuff {alias "Macintosh HD:Documents:"} into file ("Backup Drive:" & archiveName)
end tell
This method produces space-efficient, point-in-time snapshots that prevent accidental file overwrite issues.
Automated Execution Strategies in Mac OS 9
Because Mac OS 9 does not run background daemons natively, automated backup scripts must be triggered using one of several system-level approaches:
- Stay-Open AppleScript Applets: Save the script as a
"Stay Open" application containing an
on idlehandler. The script runs continuously in the background, checking the system clock and executing the backup at a defined interval (e.g., every 86,400 seconds for daily backups). - Startup and Shutdown Items: Placing compiled backup
scripts or applets into the
System Folder:Startup ItemsorSystem Folder:Shutdown Itemsdirectory ensures backups run every time the machine boots or powers off. - Energy Saver Control Panel: Users can schedule the Mac to wake up automatically at night, trigger a script saved in the Startup Items folder, perform the backup, and let the system return to sleep.
- Third-Party Schedulers: Dedicated utilities such as iDo Script Scheduler, Cron for Mac OS, or CE Software's QuicKeys can trigger individual AppleScripts at precise times without requiring persistent background applets.