chore (infra): add notification to forgejo backup script
This commit is contained in:
parent
21a161ccfc
commit
a83fd2eb72
1 changed files with 10 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
FORGEJO_MYSQL_CONTAINER="forgejo-db"
|
FORGEJO_MYSQL_CONTAINER="forgejo-db"
|
||||||
BACKUP_DIRECTORY="$HOME/backups_to_download/forgejo/"
|
BACKUP_DIRECTORY="$HOME/backups_to_download/forgejo/"
|
||||||
|
RCHAT_NOTIFIER="$HOME/"
|
||||||
source "$HOME/.env"
|
source "$HOME/.env"
|
||||||
|
|
||||||
echo "INFO Creating compressed backup of ${FORGEJO_MYSQL_CONTAINER}"
|
echo "INFO Creating compressed backup of ${FORGEJO_MYSQL_CONTAINER}"
|
||||||
|
@ -12,3 +13,12 @@ sleep 1
|
||||||
|
|
||||||
docker exec $FORGEJO_MYSQL_CONTAINER \
|
docker exec $FORGEJO_MYSQL_CONTAINER \
|
||||||
mysqldump --all-databases -u root -p$FORGEJO_MYSQL_ROOT_PASSWORD | gzip >"${BACKUP_DIRECTORY}$(date +%Y%m%d)".sql.gz
|
mysqldump --all-databases -u root -p$FORGEJO_MYSQL_ROOT_PASSWORD | gzip >"${BACKUP_DIRECTORY}$(date +%Y%m%d)".sql.gz
|
||||||
|
|
||||||
|
STATUS=$?
|
||||||
|
if [ $STATUS -eq 0 ]; then
|
||||||
|
$RCHAT_NOTIFIER "backups" "success" \
|
||||||
|
"Created backup of ${FORGEJO_MYSQL_CONTAINER} on VPS."
|
||||||
|
else
|
||||||
|
$RCHAT_NOTIFIER "backups" "error" \
|
||||||
|
"Failed to create backup of ${FORGEJO_MYSQL_CONTAINER}: problem with rsync (exit code $STATUS)."
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue