Created
January 21, 2026 16:20
-
-
Save btittelbach/d09c82ca8edbc53f75805c6a519ecb81 to your computer and use it in GitHub Desktop.
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/zsh | |
| HOST=homeassistant.lan | |
| snapname=$(date +%Y-%m-%d_%T_homeassistant_autosnap) | |
| slugname=$(ssh $HOST "source /etc/profile; ha backups new --name \"${snapname}\" " | tail -n 1 ) || exit 1 | |
| [[ -z $slugname ]] && exit 2 | |
| echo $slugname | grep -q "slug: " || exit 3 | |
| slugname=$(echo $slugname | cut -c 7-) | |
| snapfilename=backup/${slugname}.tar | |
| scp ${HOST}:${snapfilename} "./${snapname}.tar" || exit 4 | |
| ssh $HOST "source /etc/profile; ha backups remove \"${slugname}\"" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
script to trigger a homeassistant backup on homeassistant and pull it to the external server.
Can be run with a systemd.timer