Tag Archives: script

Mac OS X automated backups of Server 2.x

My colleague and I had been trying to come up with a decent backup script for Server 2.x services on Mac OS X 10.8 Mountain Lion. We had the skeleton of a Bash script from another colleague but wanted more functionality, so we began bouncing the script back and forth between us. Before we knew it, we had a working system that we now both deploy on 10.8 Server systems, osx-backup.sh.

I like to keep things simple when it comes to backup and this script is no exception. Edit the variables at the top to suit your fancy and then create a nightly cronjob to run it as root and you’re done.

Among the services that get backed up are:

  • Open Directory archive
  • Profile Manager database
  • DNS records
  • Service plists
  • Wiki
  • CalDAV & CardDAV databases

The script automatically shuts down each service that needs to be disabled before backup, then re-enables the service as soon as possible.

On the weekend, over a big pile of bacon on the weekend, we decided to turn the script loose to the community, so my colleague has posted the script on his GitHub repository. This version works with Server 2.2.2 on 10.8.5.

Caveats: Like any backup system, read the script completely and test it before putting it into production.