feat: send log to zulip
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
f 2023-09-28 10:22:09 -03:00
parent 91bf0bbe06
commit 3163150be5
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View File

@ -11,7 +11,7 @@ ENV SSH_SERVER ""
ENV SSH_USER root
ENV SSH_PORT 22
RUN apk add --no-cache borgbackup openssh-client
RUN apk add --no-cache borgbackup openssh-client zulip-client
COPY ./monit.conf /etc/monit.d/borg.conf
COPY ./backup.sh /usr/local/bin/backup

View File

@ -35,9 +35,13 @@ for signal in TERM QUIT HUP EXIT INT KILL; do
done
# It'll fail the second time
borg init --encryption=repokey "${SSH_ALIAS}:${DEST}"
borg create -v --stats "${SSH_ALIAS}:${DEST}::${DATE}" "${ORIG}"
borg prune -v --stats --keep-daily ${KEEP} "${SSH_ALIAS}:${DEST}"
borg list "${SSH_ALIAS}:${DEST}"
borg init --encryption=repokey "${SSH_ALIAS}:${DEST}" 2>&1 | tee /tmp/backup.log
borg create -v --stats "${SSH_ALIAS}:${DEST}::${DATE}" "${ORIG}" 2>&1 | tee -a /tmp/backup.log
borg prune -v --stats --keep-daily ${KEEP} "${SSH_ALIAS}:${DEST}" 2>&1 | tee -a /tmp/backup.log
borg list "${SSH_ALIAS}:${DEST}" 2>&1 | tee -a /tmp/backup.log
if test -n "${ZULIP_KEY}"; then
cat /tmp/backup.log | zulip-client -u "${ZULIP_URL}" -b "${ZULIP_BOT}" -s "${ZULIP_STREAM}" -t "${ZULIP_TOPIC}"
fi
exit $?