Updated README

This commit is contained in:
phil committed 2026-11-06 23:27:39 +00:00
1 parent d45c309110
commit 7f1a4186ea
1 file changed
+20 -21
+20 -21
View File
@@ -1,4 +1,4 @@
# Home Assistant Backup Automation Scripts # Home Assistant Backup Script
These scripts automate the backup process for **Home Assistant** servers, enabling you to create, transfer, and manage backups. The backups are securely transferred from the Home Assistant server to your local machine, with options for cleaning up old backups based on configurable retention periods. These scripts automate the backup process for **Home Assistant** servers, enabling you to create, transfer, and manage backups. The backups are securely transferred from the Home Assistant server to your local machine, with options for cleaning up old backups based on configurable retention periods.
@@ -11,33 +11,26 @@ These scripts automate the backup process for **Home Assistant** servers, enabli
- **Old Backup Cleanup**: Automatically cleans up old backups on both the Home Assistant server and local machine after a specified retention period. - **Old Backup Cleanup**: Automatically cleans up old backups on both the Home Assistant server and local machine after a specified retention period.
- **Notification Support** (Optional): Configure **ntfy** or **Discord** notifications to alert you about the backup status (available in the first script version). - **Notification Support** (Optional): Configure **ntfy** or **Discord** notifications to alert you about the backup status (available in the first script version).
## Requirements ## Requirements:
Both scripts require the following to function correctly: Both scripts require the following to function correctly:
- **Bash shell** (on your local machine and Home Assistant server) - **Linux shell** (on your local machine)
- **SSH** access to the Home Assistant server - **`ssh`** access to the Home Assistant server
- **`scp`** and **`ssh`** tools - **`scp`** and **`ssh`** tools
- **Home Assistant** installed on the server with the `ha` CLI tool - **Home Assistant** installed on the server with the `ha` CLI tool
- **Optional**: Access to a notification service (for Version 2&3) - **Optional**: Access to a notification service
## Configuration
Go port of `home_assistant_backup.sh`. Uses the same `home_assistant_backup.conf`.
## Build ## Build
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o ha-backup . ```
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o ha-backup .
Override the version at build time if needed: ```
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.version=3.1.2" -o ha-backup .
Check the version: Check the version:
./ha-backup -version ```
./ha-backup -version
Cross-compile examples: ```
GOOS=linux GOARCH=amd64 go build -o ha-backup-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -o ha-backup-linux-arm64 . # Raspberry Pi / ARM NAS
## Logging ## Logging
@@ -62,7 +55,7 @@ If the log file can't be opened, ha-backup prints a warning and continues the ba
Set `LOG_FILE` in `home_assistant_backup.conf`: Set `LOG_FILE` in `home_assistant_backup.conf`:
```bash ```
LOG_FILE="/var/log/ha-backup.log" # default LOG_FILE="/var/log/ha-backup.log" # default
LOG_FILE="/home/backupuser/ha-backup.log" # custom path LOG_FILE="/home/backupuser/ha-backup.log" # custom path
LOG_FILE="none" # disable file logging LOG_FILE="none" # disable file logging
@@ -70,9 +63,15 @@ LOG_FILE="none" # disable file logging
## Run ## Run
./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd ##### Looks for home_assistant_backup.conf next to the binary, then in cwd
./ha-backup -config /path/to.conf ```
./ha-backup
```
##### Loads the home_assistant_backup.conf from a specified file
```
./ha-backup -config /path/to.conf
```
Requires `ssh` and `scp` on the machine running it. `jq` and `yq` are no longer needed. Requires `ssh` and `scp` on the machine running it. `jq` and `yq` are no longer needed.