Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

Backing Up the Database from the Command Line Using the Jamf Pro Database Utility

Overview

Disclaimer: This article is no longer being updated. The Jamf Pro database utility was discontinued with Jamf Pro 10.14.0. For instructions on backing up the database using Jamf Pro Server Tools, see the following Knowledge Base articles:
- Backing Up the Database Using Jamf Pro Server Tools
- Backing Up and Restoring the Database Using the Jamf Pro Server Tools Command-Line Interface

This article explains how to perform the following tasks from the Jamf Pro database utility command line on macOS and Windows:

  • Create a backup of the jamfsoftware database
  • Schedule database backups
  • Stop scheduled database backups

Versions Affected

Jamf Pro 8.4 and later

Requirements

macOS

A computer with:

  • macOS Server 10.6 or later
  • MySQL Server 5.1 or later
  • Jamf Pro database utility 8.4 or later

Windows

A computer with:

  • Windows Server 2008 (64-bit)
  • MySQL Server 5.1 or later
  • Jamf Pro database utility 8.4 or later

Procedures

Creating Database Backups

Use the Jamf Pro database utility to create a backup of the jamfsoftware database. The time it takes to create the backup depends on the size of the database.

To create a database backup on macOS:

  1. Open Terminal and execute:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar backup -saveBackupTo path
    For example:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar backup -saveBackupTo /Users/YourUserName/Documents/DatabaseBackups/
  2. If prompted, type the password for your account and then press the Return key.
  3. If prompted, edit the database configuration settings to match your own by executing:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar backup -saveBackupTo path -server database server address -port database port -database database name -user database user -pass
    For example:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar backup -saveBackupTo /Users/YourUserName/Documents/DatabaseBackups/ -server localhost -port 3306 -database jamfsoftware -user jss -pass
    The Jamf Pro database utility creates the backup and saves it as a .sql.gz file. To access command-line help for the backup verb, execute:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar help backup

To create a database backup on Windows:

  1. If the User Account Control settings are enabled, make sure you are logged in as the built-in Administrator.
  2. Open Command Prompt and execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" backup -saveBackupTo "path"
    For example:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" backup -saveBackupTo "C:\Backups\"
  3. If prompted, type the password for your account and then press the Return key.
  4. If prompted, edit the database configuration settings to match your own by executing:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" backup -saveBackupTo "path" -server database server address -port database port -database database name -user database user -pass
    For example:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" backup -saveBackupTo "C:\Backups\" -server localhost -port 3306 -database jamfsoftware -user jss -pass
    The Jamf Pro database utility creates the backup and saves it as a .sql.gz file. To access command-line help for the backup verb, execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" help backup

Scheduling Database Backups

Use the Jamf Pro database utility to schedule daily backups of the jamfsoftware database. You can also automate the deletion of scheduled backups that are older than a certain number of days.

To schedule database backups on macOS:

  1. Open Terminal and execute:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar schedule -hour number between 0 and 23 -scheduledBackupPath path -deleteBackupsOlderThanDays number greater than 0
    For example:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar schedule -hour 3 -scheduledBackupPath /Users/YourUserName/Documents/ -deleteBackupsOlderThanDays 7
  2. If prompted, type the password for your account and then press the Return key.
  3. If prompted, edit the database configuration settings to match your own by executing:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar schedule -hour number between 0 and 23 -scheduledBackupPath path -deleteBackupsOlderThanDays number greater than 0 -server database server address -port database port -database database name -user database user -pass
    For example:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar schedule -hour 3 -scheduledBackupPath /Users/YourUserName/Documents/ -deleteBackupsOlderThanDays 7 -server localhost -port 3306 -database jamfsoftware -user jss -pass
    The Jamf Pro database utility saves daily backups at the hour that you specified. It also deletes scheduled backups older than the number of days that you specified. To access command-line help for the schedule verb, execute:
    sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar help schedule

To schedule database backups on Windows:

  1. If the User Account Control settings are enabled, make sure that you are logged in as the built-in Administrator.
  2. Open Command Prompt and execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" schedule -hour number between 0 and 23 -scheduledBackupPath "path" -deleteBackupsOlderThanDays number greater than 0
    For example:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" schedule -hour 3 -scheduledBackupPath "C:\Backups\" -deleteBackupsOlderThanDays 7
  3. If prompted, type the password for your account and then press the Return key.
  4. If prompted, edit the database configuration settings to match your own by executing:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" schedule -hour number between 0 and 23 -scheduledBackupPath "path" -deleteBackupsOlderThanDays number greater than 0 -server database server address -port database port -database database name -user database user -pass
    For example:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" schedule -hour 3 -scheduledBackupPath "C:\Backups\" -deleteBackupsOlderThanDays 7 -server localhost -port 3306 -database jamfsoftware -user jss -pass
    The Jamf Pro database utility saves daily backups at the hour that you specified. It also deletes scheduled backups older than the number of days that you specified. To access command-line help for the schedule verb, execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" help schedule

Stopping Scheduled Database Backups

Use the Jamf Pro database utility to stop scheduled backups of the jamfsoftware database.

To stop scheduled database backups on macOS:
Open Terminal and execute:

sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar unschedule

The Jamf Pro database utility stops scheduled backups immediately.

To access command-line help for the unschedule verb, execute:

sudo java -jar /Library/JSS/bin/JSSDatabaseUtil.jar help unschedule

To stop scheduled database backups on Windows:

  1. If the User Account Control settings are enabled, make sure that you are logged in as the built-in Administrator.
  2. Open Command Prompt and execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" unschedule
    The Jamf Pro database utility stops scheduled backups immediately. To access command-line help for the unschedule verb, execute:
    java -jar "C:\Program Files\JSS\bin\JSSDatabaseUtil.jar" help unschedule

Additional Information

For instructions on how to back up the database from the command line on supported Linux operating systems, see the Jamf Pro Installation and Configuration Guide for Linux.

For instructions on how to back up the database using the Jamf Pro database utility, see Backing Up the Database Using the Jamf Pro Database Utility.

Like Comment
Order by:
SOLVED Posted: by seanhansell

This post should be updated to note that the steps marked for OS X also work for Linux, though the paths are slightly different.

Like
SOLVED Posted: by rtrouton

For Red Hat Enterprise Linux (and RHEL-derived distros), the command to manually back up should be this:

java -jar /usr/local/jss/bin/JSSDatabaseUtil.jar backup -saveBackupTo /path/to/backup_directory

Like
SOLVED Posted: by pfedak

To run backups in Ubuntu Linux via command line immediately, use:

sudo java -jar /usr/local/jss/bin/JSSDatabaseUtil.jar backup

To schedule backups in Linux via command line, use this while replacing the <textfields> as necessary:

sudo java -jar /usr/local/jss/bin/JSSDatabaseUtil.jar backup -saveBackupTo <path> -server <database server address> -port <database port> -database <database name> -user <database user> -pass
Like
SOLVED Posted: by krispayne

What to do when JSS and MySQL are not on the same machine? Copy the JSSDatabaseUtil.jar to the MySQL server?

Like
SOLVED Posted: by NightFlight

Same question here. Is the .jar file standalone? Currently my backups are done manually with full exports, but the downtime is too high.

... few days pass

Well, you can copy the jar files and configuration. They are completely self-contained and appear so far to be platform independent. For example, supporting DOS and Unix style paths.

Next question. How are the backups stored? Are they just a plain textual export? Do they just lock one table at a time, or bring the JSS to a grinding halt? Can they be done live? We don't have downtime available anymore but also need backups.

Like
SOLVED Posted: by ocla&&09

a

Like
SOLVED Posted: by donmontalvo

Might want to add a note to this article, along the lines of:

Once you've configured backups, make sure JSSDBUtilityConfig.xml and JSSDatabaseUtil.jar are always in the same directory. If theJSSDatabaseUtil.jar is moved without the JSSDBUtilityConfig.xml, on launch it will create a new file with default settings.
Like
SOLVED Posted: by casper_ghost

@NightFlight

Did you ever get an answer to the question regarding the JSS & Database being on 2 separate servers? We are currently using this configuration in our District.

Like
SOLVED Posted: by NightFlight

Just export the .jar and the .xml together to the sql server. Issue java -jar <jarfile.jar> and any other command line parameters. The .xml is the config so you don't have to throw passwords out in the clear in your crontab, etc.

Like