diff --git a/README.md b/README.md index 0cf82ea..eec03d3 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. - **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: -- **Bash shell** (on your local machine and Home Assistant server) -- **SSH** access to the Home Assistant server +- **Linux shell** (on your local machine) +- **`ssh`** access to the Home Assistant server - **`scp`** and **`ssh`** tools - **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 - 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 . +``` +CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o ha-backup . +``` Check the 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 - +``` +./ha-backup -version +``` ## 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`: -```bash +``` LOG_FILE="/var/log/ha-backup.log" # default LOG_FILE="/home/backupuser/ha-backup.log" # custom path LOG_FILE="none" # disable file logging @@ -70,9 +63,15 @@ LOG_FILE="none" # disable file logging ## Run - ./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd - ./ha-backup -config /path/to.conf +##### Looks for home_assistant_backup.conf next to the binary, then in cwd +``` +./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.