Unimus Backup Exporter

Step 1 — Preparing Unimus and creating an API token

[~] $ mkdir unimus-exporter 
[~] $ cd unimus-backups
[~/unimus-exporter] $ wget https://github.com/netcore-jsa/unimus-backup-exporter/releases/latest/download/unimus-backup-exporter.zip
[~/unimus-exporter] $ unzip -x unimus-backup-exporter.zip
[~/unimus-exporter] $ chmod +x unimus-backup-exporter.sh

Step 3 — Setting up your config file.

Part 1 — Local backups

unimus_server_address="http://foo.bar:8085" 
unimus_api_key="insert api key here"
backup_type="latest"
export_type="fs"
  • latest - pulls the most recent backups from Unimus
  • all - pulls all backups from Unimus
#git_username="foo"
[~/unimus-exporter/backups] $ ls -l 
total 2
drwxr-xr-x 1 user group 4096 Jan 18 09:38 '192.168.4.1 - 6'
drwxr-xr-x 1 user group 4096 Jan 13 23:47 '192.168.3.1 - 2' [~/unimus-exporter/backups] $

Part 2 — Pushing to Git

git_username="foo" 
git_email="foo@bar.org"
git_server_protocal="http"
git_server_address="192.168.4.5"
git_port="22"
git_repo_name="User/unimus-backup-exporter"
git_branch="master"
git_password="password"
  • http - pushes to GIT using HTTP
  • https - pushes to GIT using HTTPS
  • ssh - pushes to git using SSH

Step 4 — Running the Exporter

[~/unimus-exporter] $ ./unimus-backup-exporter.sh 
Getting device data
Getting Device Information
Exporting latest backups
backups exported
Export successful
Script finished
[~/unimus-exporter] $
[~/unimus-exporter/backups] $ ls -l 
total 2
drwxr-xr-x 1 user group 4096 Jan 18 09:38 '192.168.4.1 - 6'
drwxr-xr-x 1 user group 4096 Jan 13 23:47 '192.168.3.1 - 2'
[~/unimus-exporter/backups] $
[~/unimus-exporter] $ ./unimus-backup-exporter.sh 
Getting device data
Getting Device Information
Exporting latest backups
backups exported
Export successful
Pushing to git
Initialized empty Git repository in /home/user/unimus-exporter/backups/.git/ [master (root-commit) 5fabcf7] Initial Commit
2 files changed, 878 insertions(+)
create mode 100644 192.168.3.1 - 2/Backup 192.168.3.1 2021-02-16-03:00:43-EST 2.txt
create mode 100644 192.168.4.1 - 6/Backup 192.168.4.1 2021-11-01-03:00:27-EDT 6.txt
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 32 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 7.61 KiB | 3.80 MiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote:
remote: The private project user/test_unimus_git was successfully created.
remote:
To ssh://192.168.4.5/user/test_unimus_git.git
* [new branch] master -> master
Everything up-to-date
Push successful
Script finished [~/unimus-exporter] $

Step 5 — Automating the exporter

0 3 * * * /path-to-script/unimus-backup-exporter.sh
Log File - 2021-11-04 21:46:16 
2021-11-04 21:46:16 Getting device data
2021-11-04 21:46:16 Getting Device Information
2021-11-04 21:46:17 Exporting latest backups
2021-11-04 21:46:17 20 backups exported
2021-11-04 21:46:17 Export successful
2021-11-04 21:46:17 Pushing to git
2021-11-04 21:46:19 Push successful
2021-11-04 21:46:19 Script finished
Log File - 2021-11-04 21:49:40 
ERROR: 2021-11-04 21:50:01 Unable to connect to unimus server

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store