feat: send log to zulip
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
91bf0bbe06
commit
3163150be5
2 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
|
|
12
backup.sh
12
backup.sh
|
@ -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 $?
|
||||
|
|
Loading…
Reference in a new issue