Compare commits
7 Commits
fb982cd646
...
bafd045a5f
| Author | SHA1 | Date |
|---|---|---|
|
|
bafd045a5f | |
|
|
8e33572053 | |
|
|
6e8539b758 | |
|
|
c31b585220 | |
|
|
3b68481bd0 | |
|
|
64eb9cb3cf | |
|
|
ecb87cf031 |
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
. /etc/backup.conf
|
. /etc/backup.conf
|
||||||
|
|
||||||
|
if [ -n "$HEALTHCHECK_URL" ]; then
|
||||||
|
curl -L "{$HEALTHCHECK_URL}/start"
|
||||||
|
fi
|
||||||
|
|
||||||
# some helpers and error handling:
|
# some helpers and error handling:
|
||||||
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
|
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
|
||||||
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
|
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
|
||||||
|
|
@ -63,4 +67,8 @@ else
|
||||||
info "Backup, Prune, and/or Compact finished with errors"
|
info "Backup, Prune, and/or Compact finished with errors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$HEALTHCHECK_URL" ]; then
|
||||||
|
curl -L "{$HEALTHCHECK_URL}/{$global_exit}"
|
||||||
|
fi
|
||||||
|
|
||||||
exit ${global_exit}
|
exit ${global_exit}
|
||||||
|
|
@ -19,9 +19,12 @@ assert getpass.getpass("Confirm passhphrase: ").rstrip() == secret_seed, "Passph
|
||||||
salted_secret_seed = hostname + secret_seed
|
salted_secret_seed = hostname + secret_seed
|
||||||
salted_hash_value = hashlib.sha512(salted_secret_seed.encode())
|
salted_hash_value = hashlib.sha512(salted_secret_seed.encode())
|
||||||
|
|
||||||
|
healthcheck_url = input("Enter healthcheck url: ").rstrip()
|
||||||
|
|
||||||
with open("/etc/backup.conf", "w") as f:
|
with open("/etc/backup.conf", "w") as f:
|
||||||
f.write(f"export BORG_REPO='ssh://{hostname}@{server_hostname}.162536.xyz:22/~/backup/docker'\n")
|
f.write(f"export BORG_REPO='ssh://{hostname}@{server_hostname}.162536.xyz:22/~/backup/docker'\n")
|
||||||
f.write(f"export BORG_PASSPHRASE='{salted_hash_value.hexdigest()}'\n")
|
f.write(f"export BORG_PASSPHRASE='{salted_hash_value.hexdigest()}'\n")
|
||||||
|
f.write(f"export HEALTHCHECK_URL='{healthcheck_url}'\n")
|
||||||
|
|
||||||
os.system("ssh-keygen -t rsa -q -f \"$HOME/.ssh/id_rsa\" -N \"\"")
|
os.system("ssh-keygen -t rsa -q -f \"$HOME/.ssh/id_rsa\" -N \"\"")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Backups
|
||||||
|
|
||||||
|
Example cron:
|
||||||
|
```sh
|
||||||
|
32 * * * * /bin/sh /root/standard-build/backup/backup-script.sh >/root/last-backup-log.txt 2>&1
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue