Automated Data Backups

Note: This information applies to SwaggerHub On-Premise.

To automate the backups of your SwaggerHub On-Premise data and configuration, you can use this bash script:


The script creates a backup and then copies it from the VM storage to the specified local DOWNLOAD_DIR. Backup file names include the timestamp, for example:

backup_2018-03-05-11-51-37UTC.tar.gz  # SwaggerHub On-Premise v. 20180116, 1.18.0 and later
backup_1519853159685.tar.gz           # earlier versions use Unix timestamps


Before running the script, specify the configuration parameters at the top of the script:


The parameters are:




Should be http(s)://{swaggerhub-host} for SwaggerHub On-Premise 1.18.5 and later, or http(s)://{swaggerhub-host}:8080 for earlier versions.


The username and password of the administrator user in your SwaggerHub On-Premise instance. This is the user created during the SwaggerHub On-Premise installation.


A local folder to copy the backup to. For example, /usr/local/swaggerhub-backups or C:/Backups/SwaggerHub/ (use the forward slashes on Windows too). Additionally, a log of the script execution will be saved to the log file in this folder.

Run the script

On Unix and Mac

Make the script executable if needed:

chmod +x /path/to/

Now, you can run it from a terminal prompt:


You can also schedule the script to run as a cron job.

On Windows

Windows users can run bash scripts using Windows Subsystem for Linux (available for Windows 10), Cygwin or Git Bash (<Git>\git-bash.exe), and schedule the scripts using Windows Task Manager.

Additional backup strategies

In addition to data and configuration backups, we recommend that you create full VM backups of your SwaggerHub On-Premise instance regularly. Refer to the documentation on your VM hypervisor to learn how to automate VM backups.

See Also

Publication date: