Skip to content

Instantly share code, notes, and snippets.

@sebastian13
Last active October 10, 2018 09:49
Show Gist options
  • Save sebastian13/0d50a63e61ec9c088c39f003c1b10deb to your computer and use it in GitHub Desktop.
Save sebastian13/0d50a63e61ec9c088c39f003c1b10deb to your computer and use it in GitHub Desktop.
#!/bin/bash

cd /docker/zabbix
source /etc/restic/repos/example.repo
source .env

CONTAINER=zabbix_mariadb_1

docker exec $CONTAINER /usr/bin/mysqldump \
	-u root --password=$DB_PASS \
	--ignore-table=zabbix.acknowledges \
	--ignore-table=zabbix.alerts \
	--ignore-table=zabbix.auditlog \
	--ignore-table=zabbix.auditlog_details \
	--ignore-table=zabbix.escalations \
	--ignore-table=zabbix.events \
	--ignore-table=zabbix.history \
	--ignore-table=zabbix.history_log \
	--ignore-table=zabbix.history_str \
	--ignore-table=zabbix.history_str_sync \
	--ignore-table=zabbix.history_sync \
	--ignore-table=zabbix.history_text \
	--ignore-table=zabbix.history_uint \
	--ignore-table=zabbix.history_uint_sync \
	--ignore-table=zabbix.trends \
	--ignore-table=zabbix.trends_uint \
	$DB_NAME | gzip --rsyncable | restic backup --stdin --stdin-filename $CONTAINER.sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment