Compare commits
No commits in common. "main" and "1.1.0" have entirely different histories.
|
|
@ -14,9 +14,6 @@ export BORG_PASSPHRASE="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
# This array must containing everything you want to include in the backup
|
# This array must containing everything you want to include in the backup
|
||||||
export BORG_TARGETS=("$HOME")
|
export BORG_TARGETS=("$HOME")
|
||||||
|
|
||||||
# Exclude directories and files
|
|
||||||
export BORG_EXCLUDE=("$HOME/.config/borg" "$HOME/.cache" "*.db")
|
|
||||||
|
|
||||||
# [optional] Use a ntfy service to publish backup results
|
# [optional] Use a ntfy service to publish backup results
|
||||||
# export NTFY=true
|
# export NTFY=true
|
||||||
|
|
||||||
|
|
|
||||||
19
README.md
19
README.md
|
|
@ -32,7 +32,6 @@ sudo apt-get install libfuse3-dev fuse3 # needed for pyfuse311
|
||||||
Prepare virutal environment.
|
Prepare virutal environment.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install python3-venv
|
|
||||||
sudo mkdir /opt/borg && cd /opt/borg
|
sudo mkdir /opt/borg && cd /opt/borg
|
||||||
sudo python3 -m venv borg-venv
|
sudo python3 -m venv borg-venv
|
||||||
```
|
```
|
||||||
|
|
@ -115,6 +114,14 @@ nano $HOME/.borg-env
|
||||||
- Set a strong passphrase
|
- Set a strong passphrase
|
||||||
- Define everything you want to include in your backup as an **absolute path** in the `BORG_TARGETS` array
|
- Define everything you want to include in your backup as an **absolute path** in the `BORG_TARGETS` array
|
||||||
|
|
||||||
|
### Publish backup result via _nfty_
|
||||||
|
|
||||||
|
You can use a [_ntfy_](https://docs.ntfy.sh/) instance to publish the result of your backup process to a _ntfy_ topic. Just set the corresponding environment variables in the `.borg-env`:
|
||||||
|
|
||||||
|
- Set `NTFY` to `true`
|
||||||
|
- Set `NTFY_URL` to the URL of your preferred _ntfy_ instance including the desired topic, e.g. `"https://ntfy.sh/myborgbackup"`
|
||||||
|
- Set your _ntfy_ token if necessary
|
||||||
|
|
||||||
Make the script executable.
|
Make the script executable.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -128,14 +135,6 @@ cd /usr/local/bin
|
||||||
ln -s /opt/borgbackup/borgbackup.sh borgbackup
|
ln -s /opt/borgbackup/borgbackup.sh borgbackup
|
||||||
```
|
```
|
||||||
|
|
||||||
### Publish backup result via _nfty_
|
|
||||||
|
|
||||||
You can use a [_ntfy_](https://docs.ntfy.sh/) instance to publish the result of your backup process to a _ntfy_ topic. Just set the corresponding environment variables in the `.borg-env`:
|
|
||||||
|
|
||||||
- Set `NTFY` to `true`
|
|
||||||
- Set `NTFY_URL` to the URL of your preferred _ntfy_ instance including the desired topic, e.g. `"https://ntfy.sh/myborgbackup"`
|
|
||||||
- Set your _ntfy_ token if necessary
|
|
||||||
|
|
||||||
### Logs
|
### Logs
|
||||||
|
|
||||||
Create a logfile with read and write permissions for every user.
|
Create a logfile with read and write permissions for every user.
|
||||||
|
|
@ -192,7 +191,7 @@ The scheduled backups can be automated by using `cron`.
|
||||||
To create scheduled backups, place this line in your `crontab` (edit with `crontab -e`):
|
To create scheduled backups, place this line in your `crontab` (edit with `crontab -e`):
|
||||||
|
|
||||||
```
|
```
|
||||||
0 3 * * * export BORG_RSH='ssh -oBatchMode=yes' && /usr/local/bin/borgbackup auto > /dev/null 2>&1
|
0 3 * * * export BORG_RSH='ssh -oBatchMode=yes' && /usr/local/bin/borgbackup auto /dev/null 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using `borg`
|
## Using `borg`
|
||||||
|
|
|
||||||
|
|
@ -47,20 +47,20 @@ trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
|
||||||
|
|
||||||
info "Starting backup"
|
info "Starting backup"
|
||||||
|
|
||||||
exclude() {
|
|
||||||
for entry in "${BORG_EXCLUDE[@]}"; do
|
|
||||||
echo "--exclude $entry"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Backup the most important directories into an archive named after
|
# Backup the most important directories into an archive named after
|
||||||
# the machine this script is currently running on:
|
# the machine this script is currently running on:
|
||||||
|
|
||||||
borg_command=("create" "--verbose" "--filter=AME" "--list" "--stats" "--show-rc" "--compression=lz4" "--exclude-caches")
|
/usr/local/bin/borg create \
|
||||||
borg_command+=($(exclude))
|
--verbose \
|
||||||
borg_command+=("::${mode}-backup-{hostname}-{now}" "${BORG_TARGETS[@]}")
|
--filter AME \
|
||||||
|
--list \
|
||||||
/usr/local/bin/borg "${borg_command[@]}"
|
--stats \
|
||||||
|
--show-rc \
|
||||||
|
--compression lz4 \
|
||||||
|
--exclude-caches \
|
||||||
|
\
|
||||||
|
::"${mode}-{hostname}-{now}" \
|
||||||
|
"${BORG_TARGETS[@]}" \
|
||||||
|
|
||||||
backup_exit=$?
|
backup_exit=$?
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue