Automated backups of Open Directory databases

# Automated backups of Open Directory databases (ldap / kerberos / password server)
# This needs to run as root and should be mode 700 due to embedded password

# Get current date
TODAY=`/bin/date +'%m-%d-%y_%H:%M:%S'`

# Set destination directory  (do not include trailing slash!)
DSTDIR=/path/to/backups

# Set archive password (needed to restore from / unlock the resulting dmg)
PASS="the_foo"

# Feed a heredoc to serveradmin
/usr/sbin/serveradmin command <<EOF
dirserv:backupArchiveParams:archivePassword = $PASS
dirserv:backupArchiveParams:archivePath = $DSTDIR/od_backup_$TODAY
dirserv:command = backupArchive
EOF

About dre

I like all kinds of food.
This entry was posted in OS X Server, scripts. Bookmark the permalink.

Leave a Reply