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.
30 lines
1.1 KiB
30 lines
1.1 KiB
#!/bin/bash -e
|
|
|
|
{% 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 \
|
|
--clear \
|
|
--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 %}
|
|
|