Bender - Automated Backup of OS X Server Settings

Follow

Comments

1 comment

  • Avatar
    Ben Greiner

    Recent feedback received:

    I had problems with ProfileManager and fixed it by adding 

    sudo -u _devicemgr

    in front of

    /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0 -c -f "$backupDestination"/ProfileManager/device_management-$host-$date.sql

    If I change backupDestination="/Backups/$date" I also have to change:

    find "$pathBackups/Backups" -mtime +$keepUntil -maxdepth 1 -exec rm -rf {} \;

    For Calendar backup I added:

    function CalendarBackup () {
    # Ensure the backup directory is present and assign the path as a variable.
    /bin/mkdir -p "$backupDestination"/Calendar
    # Create a backup of profilemanager database.
    /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h /var/run/caldavd/PostgresSocket/ --username=caldav caldav -f "$backupDestination"/Calendar/caldav-$host-$date.sql
    if [ $? == 0 ]; then
    LogEvent "[ backup ] Calendar successfully backed up."
    else
    LogEvent "[ error ] Could not back up Calendar. Exit Code: $?"
    fi
    }

Please sign in to leave a comment.