Created
March 21, 2020 00:20
-
-
Save bdwilson/e320283934447f2a964b1a7a03677265 to your computer and use it in GitHub Desktop.
Backup hubitat device using last backup file created.
This file contains 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/bash | |
# | |
# Code borrowed from https://community.hubitat.com/t/solved-downloading-latest-backup-file/18065/5 | |
# | |
IP=$1 | |
DIR="$2" | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <IP Address> <Path to store backup>" | |
else | |
curl -s http://${IP}/hub/backup | grep data-fileName | grep download | sed 's/<td class=\"mdl-data-table__cell--non-numeric\"><a class=\"download mdl-button mdl-js-button mdl-bu | |
tton--raised mdl-js-ripple-effect\" href=\"#\" data-fileName=\"/\ /' | sed 's/\">Download<\/a><\/td>/\ /' | sed 's/ //g' | tail -1 | xargs -I @ curl -s -o ${DIR}/${IP}_@ http://${IP}/h | |
ub/backupDB?fileName=@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment