Skip to content

Instantly share code, notes, and snippets.

@pszafer
Created January 22, 2019 17:22
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 pszafer/2035523359bf096606bd919bf3998102 to your computer and use it in GitHub Desktop.
Save pszafer/2035523359bf096606bd919bf3998102 to your computer and use it in GitHub Desktop.
home assistant backup
#!/bin/sh
USER="root"
PASSWORD=""
DEST="/pictures/backup"
TYPE=$1
case "$1" in
weekly)
OUTPUT="$DEST/weekly"
rm -rf $DEST/daily/*.tar.gz
;;
monthly)
OUTPUT="$DEST/monthly"
rm -rf $DEST/daily/*.tar.gz $DEST/weekly/*.sql.gz $DEST/monthly/*.tar.gz
;;
daily) OUTPUT="$DEST/daily" ;;
custom) OUTPUT="$DEST/custom" ;;
*) exit 0 ;;
esac
tar zc -f $OUTPUT/`date +%Y%m%d`.tar.gz /root/.homeassistant/ /root/.node-red
sftp ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment