Backing up my web sites using Transmit

After 5 years (!?) I thought I would automate the backing up of my (very simple) web sites.

I’ve been using Interarchy for a very long time but I thought I would use Transmit to do this.

A few caveats to get started:

  1. What I’m actually doing is synchronizing the remote site to the local location
  2. That means that I started Transmit and added a Favorite to the app represents the top level of the FTP location
  3. Most of the script comes from Panic samples called ‘Transmit 4 AppleScript samples’. I added a few lines to set the AppleScript timeout and loop through the sites
  4. This is an AppleScript. I’ll probably convert it to Javascript at some point.

I’ve included the script below.

Once I got the script running the way I wanted it to I saved the script as an ‘Application’.

I then went over to Automator and created a “Calendar Alarm” item. I used the ‘Run Application’ event and selected my Script application. Hit save and Calendar will fire up and an event will be created. Note that event creation will trigger the script attached to it. Wish it didn’t do that but whatever. One other thing to mention is that the Calendar that is created is local to the machine where you used Automator to create the Calendar Alarm.

Set the schedule for the event and you are done. The next time the event date/time hits the Script application will fire and bam… your files will be backed up.

There are a lot of tweaks that the script could use that I will add as time goes on.

Also note that you need follow through on other steps to make sure that the data is good such as restoring the data, checking its ok, etc, etc.

Now… to back up those MySQL databases!

Here’s the script:

— Connect to FTP Server and sync remote directories to local directories
— 2010 Panic Inc.
— Mild modifications made by JAG, 2018

tell application "Transmit"
  with timeout of (15 * 60) seconds
  tell application "Transmit"
-- Prevent interactive alerts from popping up during script execution
set SuppressAppleScriptAlerts to true

-- Set some variables to values to be used later in the script
set myFTPServer to item 1 of (favorites whose name is “NameOfYourFTPLocation")
set pathToMainBackupDirectory to "/Volumes/Drobo/Backups - Web Sites/"
set listOfSites to {“directory_1", “directory_2", “directory_3"}

-- Start working with Transmit
-- Loop through the list of sites, change the remote and local browser path and sync
-- the remote site to the local site
repeat with a from 1 to length of listOfSites
set theCurrentSiteListItem to item a of listOfSites
tell current tab of (make new document at end)
-- Connect to the FTP Server
connect to myFTPServer

-- Change the path for the remote browser to correct path on the FTP server
change location of remote browser to path theCurrentSiteListItem

-- Chagne the path for the local browser to location of the backup
change location of local browser to path "/Volumes/Drobo/Backups - Web Sites/" & theCurrentSiteListItem as string

-- Tell Transmit 5 to sychronize the remote location to the local location
synchronize remote browser to local browser

-- Close the remote browser window
close remote browser
end tell
end repeat
set SuppressAppleScriptAlerts to false
end tell
end timeout
end tell

Owl at Cooley Lake

Not the greatest picture but this is the first time I’ve seen an Owl out here. Lots of red-tailed hawks.

I just happened to catch him (her?) flying out the corner of my eye. 

Owl at Cooley Lake

Homebuilt bookshelf

Been working all summer to get my garage and shed organized. Projects started but not finished abound! Trying to get them  finished one by one. 

Here’s one of the projects. I thought this was my first bit of furniture but it’s the second.

It was an interesting piece to build. The supports are L angle steel hit with a grinding wheel and lacquered. The shelves are 2×6 pine stained very lightly, hit with a torch to bring out the grain and coated with poly-acrylic to provide a bit of protection. 

IMG 4763

Reading Stephen King’s Dark Tower again

Somewhere along the line I started this series…and then lost track of it. Since the movie is coming out in early August I thought I would read the first book again and then pick up the rest of the series. I seem to at least have gotten through the second book as well since I remember the ‘lobstrosities’.

Anyway, check out the first book in the series here.

Handle inevitable mistakes well…

“The point is, any system in which humans are involved will at some point be disrupted by human error. Organizations distinguish themselves not by stamping out the possibility of error, but by handling the inevitable mistake well.”