Created
February 10, 2020 18:47
-
-
Save brycied00d/7bdabd5711449d3a64f32ab524f62cda to your computer and use it in GitHub Desktop.
Script to fetch/download a backup from a Zeroshell system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This is a quick, simple script to download a profile backup from a Zeroshell | |
# instance. It has been tested with release 3.9.3 | |
# No warranty or guarantee of any kind is made, nor any support offered. | |
# Copyright Bryce Chidester <[email protected]> | |
# Configuration: Replace <hostname>, <username>, and <password> as appropriate. | |
endpoint='https://<hostname>/cgi-bin/kerbynet' | |
username=<username> | |
# I know, storing a password like this sucks. Blame Zeroshell for a lack of | |
# better alternatives. Remember to quote the string if necessary. | |
password=<password> | |
# These values come from the ZeroShell GUI. The device is the value in the | |
# parenthesis on the "Disk Model" line, eg: if it says "(sda)" then | |
# device=_dev_sda | |
# For partition, this is the value in the left column. For example if it says | |
# "sda1" then partition=_dev_sda1 | |
# Finally, db is the name under the "Profile" heading, eg. _DB.001 | |
device=_dev_sda | |
partition=_dev_sda1 | |
db=_DB.001 | |
# To exclude logs from the backup, exclude_logs=Yes | |
# To include logs in the backup, exclude_logs= | |
exclude_logs= | |
# Directory to download the backup to. By default $(dirname $0) is the same | |
# directory as this script is located. | |
cd $(dirname $0) | |
TOK=$(curl -sS $endpoint -d Action=StartSessionSubmit -d "User=${username}" -d "PW=${password}" | awk -F 'STk=' '{ print substr($2, 1, index($2, "&")-1) }') | |
curl -sS -OJR $endpoint -d Section=Storage -d "STk=${TOK}" -d Action=BackupDB -d "WOLOGS=${exclude_logs}" -d "What=${device}" -d "Part=${partition}" -d "DB=${db}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment