Moved V1 and V2 of the scripts into their own Repos and archived them
V1 - https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V1/ V2 - https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V2 Moved V3 code into main dir Updated and merged README file
This commit is contained in:
1 parent
caae2fb707
commit
d45c309110
10 files changed
+60
-502
No files matched your search
@@ -11,17 +11,6 @@ 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).
|
||||
|
||||
### Three Versions of the Script:
|
||||
|
||||
1. **Version 1**
|
||||
A simpler version that creates a backup, copies it to your local machine, and performs a basic cleanup of old backups locally. No notification system is included in this version.
|
||||
|
||||
2. **Version 2**
|
||||
This version includes backup creation, local and remote cleanup of old backups, and optional notifications via **ntfy** and **Discord**. It also checks for available disk space before cleaning up old backups.
|
||||
|
||||
3. **Version 3 (RECOMMENDED)**
|
||||
This version continues on from 2.0.1 but it has now been ported to Go and has a Go binary
|
||||
|
||||
## Requirements
|
||||
|
||||
Both scripts require the following to function correctly:
|
||||
@@ -34,7 +23,66 @@ Both scripts require the following to function correctly:
|
||||
|
||||
## Configuration
|
||||
|
||||
Each version has different configuration files
|
||||
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 .
|
||||
|
||||
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
|
||||
|
||||
|
||||
## Logging
|
||||
|
||||
ha-backup writes a log to `/var/log/ha-backup.log` by default. Each line is timestamped, and the file is appended to on every run. The same output is still printed to the console.
|
||||
|
||||
### Create the log file
|
||||
|
||||
Writing to `/var/log` requires elevated permissions, so create the file once and give ownership to the user that runs the backup. Replace `backupuser` with that user (use `root` if you run it as root):
|
||||
|
||||
|
||||
If you'd rather do it in steps:
|
||||
|
||||
```
|
||||
sudo touch /var/log/ha-backup.log
|
||||
sudo chown backupuser:backupuser /var/log/ha-backup.log
|
||||
sudo chmod 640 /var/log/ha-backup.log
|
||||
```
|
||||
|
||||
If the log file can't be opened, ha-backup prints a warning and continues the backup without file logging.
|
||||
|
||||
### Change or disable the log location
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
## Run
|
||||
./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd
|
||||
./ha-backup -config /path/to.conf
|
||||
|
||||
|
||||
Requires `ssh` and `scp` on the machine running it. `jq` and `yq` are no longer needed.
|
||||
|
||||
## Three Versions of the Script:
|
||||
|
||||
This project used to contain three versions of this project. V1 and V2 have both been moved to their own repositorys and archived as they will no longer be developed and previous releases will be kept but marked as "Pre-Release"
|
||||
|
||||
1. **Version 1: See [https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V1](https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V1)**
|
||||
|
||||
2. **Version 2: See [https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V2](https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V2)**
|
||||
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Reference in new issue
Block a user