FileMaker Server 11 backup using launchd

FMS scheduled backups are made into default /Library/FileMaker Server/Data/Backups. Options allow all databases, or specified folders, or specified Databases. A scheduled hourly backups are saved directly into Backups directory and timestamped

  • Hourly_2010-06-29_1400
  • Daily_2010-06-29_1915
  • Weekly_2010-06-29_1430

A launchd daemon executes a shell script, to copy the backup directory 'Hourly' into /Users/Shared/fms_backups The backup file is a zip archive , date and time stamped, so sequential archives are preserved: 10-07-02_1037.zip

Shell script

Shell script saved into ~Library/Scripts/

#!/bin/sh
SRC=/Library/FileMaker\ Server/Data/Backups
DST=/Volumes/xsrv/Users/Shared/fms_backups/
TODAY=$(date +%y-%m-%d_%H%M)
ditto -c -k -rsrc "${SRC}" "${DST}${TODAY}.zip"

Launchd xml file using Lingon

example uses run every 30 minutes. Although logout is meant to reset changes to the launchd file, restart is more reliable

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.cortical.bupHourlyLaunchd</string>
<key>ProgramArguments</key>
<array>
<string>/Users/admin/Library/Scripts/bup_fms.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>1800</integer>
</dict>
</plist>

Example: launchd backup to external (usb) drive

The LAN device needs to be mounted, the following shell script does not mount it or log into it. Establishing the path - the usual trick of dragging the target directory onto a terminal to parse the path does not work for LAN devices the parentheses in the target volume share <NAS8CEEDE(AFP)> require escaping access permissions can be an issue.

#!/bin/sh
SRC=/Library/FileMaker\ Server/Data/Backups
DST=/Volumes/NAS8CEEDE\(AFP\)/
TODAY=$(date +%y-%m-%d_%H%M)
ditto -c -k -rsrc "${SRC}" "${DST}${TODAY}.zip"

Copy a single specific fms hourly backup to an archive of the same name

Hourly_2010-07-09_1700 >> 2010-07-09_1700.zip
the script recalculates for each day at the same time; but will accumulate the hour copies for each day, because the zip is named with the date, which will of course change each day.

#!/bin/sh
SRC=/Library/FileMaker\ Server/Data/Backups
DST=/Volumes/NAS8CEEDE\(AFP\)/
TODAY=$(date +%y-%m-%d_%H%M)
ditto -c -k -rsrc "${SRC}" "${DST}${TODAY}.zip"

Copy a single specific fms hourly backup to an archive of the same name

Hourly_2010-07-09_1700 >> 2010-07-09_1700.zip
the script recalculates for each day at the same time; but will accumulate the hour copies for each day, because the zip is named with the date, which will of course change each day.

#!/bin/sh
#this will copy a specific fms hourly backup, to an archive of the SAME name
SRC=/Library/FileMaker\ Server/Data/Backups/
DST=/Volumes/xsrv/Users/Shared/fms_backups/
TODAY=$(date +%Y-%m-09_1700)
ditto -c -k -rsrc -V "${SRC}Hourly_${TODAY}" "${DST}${TODAY}.zip"