Compare commits
No commits in common. "1e3638d474b0e3d522e9ec538927ff334f3bef9b" and "693ded862cb13b5fe8b6d6a073fd117c28c6c9ff" have entirely different histories.
1e3638d474
...
693ded862c
15
README.md
15
README.md
@ -12,21 +12,6 @@ Run this:
|
|||||||
debuild -i -us -uc
|
debuild -i -us -uc
|
||||||
```
|
```
|
||||||
|
|
||||||
## New release
|
|
||||||
|
|
||||||
Add comments:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
dch -v 0.2 "comment 1"
|
|
||||||
dch -v 0.2 "comment 2"
|
|
||||||
```
|
|
||||||
|
|
||||||
Release:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
dch --release --distribution stable
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Just install the package as usual.
|
Just install the package as usual.
|
||||||
|
34
btrbk-cron
34
btrbk-cron
@ -4,11 +4,8 @@ CONF=/etc/btrbk/btrbk-cron.conf
|
|||||||
LOGFILE=$(mktemp)
|
LOGFILE=$(mktemp)
|
||||||
trap 'rm -f -- "${LOGFILE}"' EXIT
|
trap 'rm -f -- "${LOGFILE}"' EXIT
|
||||||
|
|
||||||
echo "---" | tee -a "${LOGFILE}"
|
|
||||||
echo "Start btrbk-cron: $(date||true)" | tee -a "${LOGFILE}"
|
|
||||||
|
|
||||||
if [[ ! -f "${CONF}" ]] ; then
|
if [[ ! -f "${CONF}" ]] ; then
|
||||||
echo "Warning: Can't read config file (${CONF}), healthchecks disabled." | tee -a "${LOGFILE}"
|
echo "Warning: Can't read config file (${CONF}), healthchecks disabled."
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC1090,SC1091
|
# shellcheck disable=SC1090,SC1091
|
||||||
source "${CONF}"
|
source "${CONF}"
|
||||||
@ -19,37 +16,10 @@ HEALTHCHECK_ENABLE=${HEALTHCHECK_ENABLE:-false}
|
|||||||
CURLOPTS=(-fsS -m 10 --retry 5)
|
CURLOPTS=(-fsS -m 10 --retry 5)
|
||||||
|
|
||||||
if [[ ! -d /run/btrbk ]] ; then
|
if [[ ! -d /run/btrbk ]] ; then
|
||||||
echo "Warning: Creating missing directory: /run/btrbk " | tee -a "${LOGFILE}"
|
|
||||||
mkdir -p /run/btrbk
|
mkdir -p /run/btrbk
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${HEALTHCHECK_ENABLE}" = "true" ]] ; then
|
echo "---" | tee -a "${LOGFILE}"
|
||||||
echo "Info: Healthchecks enabled with URL: ${HEALTHCHECK_URL}"
|
|
||||||
else
|
|
||||||
echo "Info: Healthchecks disabled"
|
|
||||||
fi
|
|
||||||
|
|
||||||
HOST=$(grep -E '^[\ \t]*target[\ \t]+send-receive' /etc/btrbk/btrbk.conf)
|
|
||||||
# TODO: support for dashes in hostname and IPv6 ("[2001:db8::7]")
|
|
||||||
HOST=$(echo "${HOST}" | sed -r 's/.*ssh:\/\/([0-9\.a-zA-Z]+).*/\1/g' )
|
|
||||||
|
|
||||||
IDENTITYFILE=$(grep -E '^[\ \t]*ssh_identity[\ \t].*' /etc/btrbk/btrbk.conf )
|
|
||||||
IDENTITYFILE=$(echo "${IDENTITYFILE}" | sed -r 's/.*ssh_identity[\ \t]+//g')
|
|
||||||
|
|
||||||
SSHUSER=$(grep -E '^[\ \t]*ssh_user[\ \t].*' /etc/btrbk/btrbk.conf )
|
|
||||||
SSHUSER=$(echo "${SSHUSER}" | sed -r 's/.*ssh_user[\ \t]+//g')
|
|
||||||
|
|
||||||
SSH_OK=$(ssh -i "${IDENTITYFILE}" "${SSHUSER}@${HOST}" "which btrfs")
|
|
||||||
|
|
||||||
if [[ "${SSH_OK}" = "" ]] ; then
|
|
||||||
echo "Warning: exiting because of backup destination unreachable" | tee -a "${LOGFILE}"
|
|
||||||
if [[ "${HEALTHCHECK_ENABLE}" = "true" ]] ; then
|
|
||||||
curl "${CURLOPTS[@]}" --data-binary "@${LOGFILE}" "${HEALTHCHECK_URL}/log"
|
|
||||||
fi
|
|
||||||
rm -f -- "${LOGFILE}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Start backup: $(date||true)" | tee -a "${LOGFILE}"
|
echo "Start backup: $(date||true)" | tee -a "${LOGFILE}"
|
||||||
if [[ "${HEALTHCHECK_ENABLE}" = "true" ]] ; then
|
if [[ "${HEALTHCHECK_ENABLE}" = "true" ]] ; then
|
||||||
curl "${CURLOPTS[@]}" "${HEALTHCHECK_URL}/start"
|
curl "${CURLOPTS[@]}" "${HEALTHCHECK_URL}/start"
|
||||||
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,10 +1,4 @@
|
|||||||
btrbk-cron (0.2) stable; urgency=medium
|
btrbk-cron (0.1) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Added destination aliveness check
|
|
||||||
|
|
||||||
-- Paolo Asperti <paolo@asperti.com> Tue, 24 Sep 2024 16:08:04 +0200
|
|
||||||
|
|
||||||
btrbk-cron (0.1) stable; urgency=medium
|
|
||||||
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user