I had a scare last week where I thought I might have lost a whole mess of data from my production server, and realized I didn’t have a recent backup of either of my websites. Last night I set up the new server in the basement with a pair of Automator scripts based on the original one I’d written last year, utilizing built-in functionality in the superb Transmit and a little AppleScript-fu.
The first step is to have Automator open Transmit. Next we add a Transmit-specific Synchronize command to back up only the latest files from the remote server.
Once that’s all done, I had to do a little research to figure out how to close Transmit, because Automator 1.0.5 doesn’t come with a premade “close application” action (although the 2.0 version does). Drag the “Run AppleScript” action to the bottom, and in the supplied text area, replace
(* Your script goes here *)
with
Tell application “Transmit” to quit
Note: this screenshot is from Automator 2.0, but the basics are the same.
Save it out as an application, and then add it into a repeating iCal event to run weekly or monthly.
Next I’m going to tack on the email notification script I worked out before. One problem I had with that script was that even when the script did not run successfully—if the computer was asleep or shut off, for example—it still emailed me saying it had. I don’t know why this happened, but since this server is scheduled to run constantly, I shouldn’t have that problem.