Last active
June 4, 2020 14:41
-
-
Save bdwilson/1f707fd7adf1946d9955238eeef9922f to your computer and use it in GitHub Desktop.
Hubitat Backup (to be run on a Linux/Rpi)
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/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> <PATH>" | |
else | |
curl -s http://${IP}/hub/backup | grep data-fileName | grep download | sed 's/<td class=\"mdl-d | |
ata-table__cell--non-numeric\"><a class=\"download mdl-button mdl-js-button mdl-button--raised mdl-js-r | |
ipple-effect\" href=\"#\" data-fileName=\"/\ /' | sed 's/\">Download<\/a><\/td>/\ /' | sed 's/ //g' | | |
tail -1 | xargs -I @ curl -s -o ${DIR}/${IP}_@ http://${IP}/hub/backupDB?fileName=@ | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment