You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
|
|
{% for db in mailman_db_name.keys() | list %}
|
|
|
|
{% if mailman_db_engine == 'postgres' %}
|
|
|
|
{% if mailman_db_server not in ['localhost', '127.0.0.1'] %}
|
|
|
|
PGPASSWORD={{ mailman_db_pass | quote }} \
|
|
|
|
/usr/pgsql-13/bin/pg_dump \
|
|
|
|
--clean \
|
|
|
|
--create \
|
|
|
|
--username={{ mailman_db_user | quote }} \
|
|
|
|
--host={{ mailman_db_server | quote }} \
|
|
|
|
--port={{ mailman_db_port }} \
|
|
|
|
{{ mailman_db_name[db] }} | \
|
|
|
|
zstd -c > {{ mailman_root_dir }}/backup/{{ mailman_db_name[db] }}.sql.zst
|
|
|
|
{% else %}
|
|
|
|
su - postgres -c "/usr/pgsql-13/bin/pg_dump --clear {{ mailman_db_name[db] }}" | \
|
|
|
|
{% endif %}
|
|
|
|
zstd -c > {{ mailman_root_dir }}/backup/{{ mailman_db_name[db] }}.sql.zst
|
|
|
|
{% else %}
|
|
|
|
/usr/bin/mysqldump \
|
|
|
|
{% if mailman_db_server not in ['localhost', '127.0.0.1'] %}
|
|
|
|
--user={{ mailman_db_user | quote }} \
|
|
|
|
--password={{ mailman_db_pass | quote }} \
|
|
|
|
--host={{ mailman_db_server | quote }} \
|
|
|
|
--port={{ mailman_db_port }} \
|
|
|
|
{% endif %}
|
|
|
|
--quick --single-transaction \
|
|
|
|
--add-drop-table {{ mailman_db_name[db] }} | \
|
|
|
|
zstd -c > {{ mailman_root_dir }}/backup/{{ mailman_db_name[db] }}.sql.zst
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|