Bender - Automated Backup of OS X Server Settings

Follow

Comments

10 comments

  • 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
    }
    0
    Comment actions Permalink
  • Ishai Beit Halachmi

    Hi Ben,

    Thanks for the tip using 'sudo -u _devicemgr' 

    We are now able to backup profile manager successfully

    However - we are unable to restore - we get sql error - 

    psql: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/Library/Server/ProfileManager/Config/var/PostgreSQL/.s.PGSQL.5432

    Running macOS Sierra 10.12.6 with Server 5.3.1 

    Have you seen this error before ?

    Thanks

     

    0
    Comment actions Permalink
  • Ben Greiner

    Hi Ishai, Did you try the note mentioned above about restoring Profile Manager in 10.12?

    0
    Comment actions Permalink
  • Ishai Beit Halachmi

    Hi Ben - which mention would that be ? This one ?

    To restore Profile Manager:

    sudo cat /path/to/your-profile-backup.sql | psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0 

     

    0
    Comment actions Permalink
  • Ben Greiner

    Ishai, you mentioned running 10.12 so I believe this is the one you want ...

    To restore Profile Manager in macOS Sierra 10.12.3 and Server.app 5.2: (Thanks to Paul Roomberg for figuring this out!)

    sudo pg_restore <path to .pgdump file> -U _devicemgr

     

    0
    Comment actions Permalink
  • Ishai Beit Halachmi

    Thanks Ben,

    I have probably missed out on this one but this one is for Server.app 5.2 and when trying to restore i get this 

    pg_restore: [archiver] input file appears to be a text format dump. Please use psql

    I understand this is probably a change in Server.app =>5.3 (Also the pg_dump issue you managed to resolve) 

    I will try to get to the bottom of this cause losing our PM database without a way to restore it easily is a major issue 

    Thanks again !

    0
    Comment actions Permalink
  • Ben Greiner

    Hi Ishai, Did you have any luck finding a way to restore?

    0
    Comment actions Permalink
  • Ishai Beit Halachmi

    Hi Ben,

    I haven't managed to restore the DB.

    Ishai 

    0
    Comment actions Permalink
  • Erik Teurlings

    I need to restore my (wiki) OS X Server (macOS 10.12.6, macOS Server 5.3.1) configuration. The serveradmin command is not found. I type this in macOS terminal. Terminal says command not found. Do I type it in terminal, because the serveradmin command is not found or somewhere else? How can I use the serveradmin command in Terminal?

     

    My bender backup is in the file named 2018-08-15-2200 with 3 subdirecotries, so I type

    sudo serveradmin settings \Volumes\name\BenderBackups\2018-08-15-2200

    Is this correct?

     

    At the addiitonal options there s a typo: .pist instead of .plist

    0
    Comment actions Permalink
  • Rubi N

    Hi Ben!

    I tried to install Bender in my snow leopard server, but the installation failed, do you have any idea why? It runs OS 10.6, and the message only was "Installation failed, the installer encountered an error that caused the installer to fail, contact the software manufacturer for assistance". We want to migrate this server to a newer machine running El Capitan, do you think this could be one way to perform that upgrade? 

     

    Thanks,

     

    Rubí.

    0
    Comment actions Permalink

Please sign in to leave a comment.