Skip to content

Instantly share code, notes, and snippets.

@bdwilson
Last active June 4, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdwilson/1f707fd7adf1946d9955238eeef9922f to your computer and use it in GitHub Desktop.
Save bdwilson/1f707fd7adf1946d9955238eeef9922f to your computer and use it in GitHub Desktop.
Hubitat Backup (to be run on a Linux/Rpi)
#!/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