Scheduling Website Backups with Transmit

This post is 10 years old. The screenshots have been removed.

I’d been manually backing up my website whenever I did changes and I use the synchronize feature in Transmit to do it. Transmit is a FTP client for the Mac by Panic Software. Transmit remembers settings between sessions so it was easy enough to do this if the only synchronize I ever did was the web backup. Or if I trusted myself to reset things correctly before each session. Since the whole point of synchronize is to only copy/delete the changes it’s important to keep things the same. Plus it’s only a matter of time before an errant or missed setting uploads instead of downloads or causes some other disaster. So I put on a pot of coffee and prepared to automate the process.

It was so trivial I was done before the coffee was brewed. You can adapt these procedure for pretty much any synchronization. The procedures are for backing up the files on my website down to my local Mac. The databases are not backed up, only files.

Create the Automator Script

1. Create a Favorite connection in transmit that connects to the top directory of the tree you want to back up. In my case it’s /public_html on my server so I back up my production and test websites which are are subdirectories under this directory.

2. Create a folder on your Mac to serve as a backup destination. I created WebBackups/websites under Documents. The ftp synchronize will put the files in the websites sub-folder. I created it as a sub-folder of WebBackups so I could also add other backups later such as database backups or safety backups before an upgrade. I’ll also but the automator script in WebBackups.

3. Open Automator, locate “Transmit” in the Library list, then select “Synchronize Files” in the Action list and drag it to the workflow window. Click the thumbnails to see full size.

 

4. In the “Connect To” drop down select “Favorite”. This will give you the following options:

 

5. Select the Favorite you created in step one as the “Favorite”.

6. Select Download as the “Sync Direction”.

7. Select Mirror as the “Sync Method”. This will make the directory on your Mac match the server each time it is run. This will delete files so be sure the source and destination are set correctly.

8. Select the directory you created in step 2 as the “Local Path”.

I don’t skip any files even though some will be hidden in Finder by default. I’ve found the automatic time offset works fine. The screen shot below shows my settings.

 

9. Save the Automator script (yes, just one action) as an application. From the menu select File -> Save As then select “Application” as the file format. Save the file as WebsiteBackup.app to the /WebBackups directory created in step 2 (not the Websites subdirectory).

Schedule the Backup

1. Open iCal.

2. This is optional but recommended. Create a new calendar called “System Tasks”. This will allow you to segregate your scheduled computer tasks from your appointments and todos. Select File -> New Calendar from the menu.

3. Create a new event. Select the time you want the backup to run and tell it to repeat every day. For the Alarm select “Open File” as the action. The alarm type will say iCal, change it to the the WebsiteBackup automator app you created up above. Do this by selecting “Other” and browsing for it. Set the alarm to 0 minutes before. The completed event is shown below.

 

Summary

You do need to be logged onto the Mac for this to run and the Mac cannot be in sleep mode when the event is scheduled to occur. Neither iCal or Transmit need to be running. Transmit will open, run the sync, then shut down. As I mentioned, some files will be hidden in Finder. These are the files that begin with a dot (.) such as .htaccess. These files will be viewable in Transmit and can be copied back if necessary.

The first sync will take some time although exactly how much depends on your website and link speed. Future syncs will be quicker since only changes are copied.

One the downside, there’s no logs and if the link is down at the appointed time the sync will fail silently. You should check the backup occasionally to make sure it’s working.

5 thoughts on “Scheduling Website Backups with Transmit”

  1. This is a great solution for creating an automatic local backup of the upload folder for WordPress based sites.

    Thanks for posting this!

  2. I have used these setting to automate a sync of my website on Mac OS 10.6.7… perfect! However, I am getting a Transmit 4.1.5 error message after the automated procedure that reads: Some files could not be downloaded. The synchronisation completed, but some errors were encountered during the transfer. Double check your settings or re-attempt to synchronise these folders: xxxxxxx.com.2011-06.cache."

    Huh?? 🙂 Cheers!

    1. @Rachel – Since it appears to be a cache file I suspect the file/folder was deleted between the time Transmiit got to it. It appears Transmit determines what files to sync and then goes back to sync it. Or if it's the same folder all the time – I've received a similar error and found it to be transmit didn't have permissions to access the file. Once I corrected the permissions on it everything went fine. It could be the web server is creating the files bit not giving the Transmit user ID access to the folder. If you didn't already, running the sync manually may pop up a more informative error.

      Hope this helps. Good luck.
      Ray

  3. One question regarding this – will the script still run if the screensaver / password lock go into effect?

    1. @buckymcsatan – It’s been awhile since I’ve done this and OS X has been upgraded since then. But it did work if the screensaver lock kicks in. I don’t see why it wouldn’t now as I have other scripts that run. It doesn’t work if sleep kicks in.

      Ray

Comments are closed.