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.
20 lines
839 B
20 lines
839 B
3 years ago
|
#!/bin/sh
|
||
|
|
||
|
set -eo pipefail
|
||
5 years ago
|
|
||
|
mkdir -p /home/lbkp/bitwarden_rs/
|
||
|
cp {{ bitwarden_root_dir }}/data/rsa* {{ bitwarden_root_dir }}/backup/
|
||
|
{% if bitwarden_db_engine == 'mysql' %}
|
||
|
/usr/bin/mysqldump \
|
||
|
{% if bitwarden_db_server != 'localhost' and bitwarden_db_server != '127.0.0.1' %}
|
||
3 years ago
|
--user={{ bitwarden_db_user }} \
|
||
|
--password={{ bitwarden_db_pass | quote }} \
|
||
|
--host={{ bitwarden_db_server }} \
|
||
5 years ago
|
{% endif %}
|
||
|
--quick --single-transaction \
|
||
5 years ago
|
--add-drop-table {{ bitwarden_db_name }} | zstd -T0 -c > {{ bitwarden_root_dir }}/backup/{{ bitwarden_db_name }}.sql.zst
|
||
5 years ago
|
{% else %}
|
||
|
sqlite3 {{ bitwarden_root_dir }}/data/db.sqlite3 ".backup '{{ bitwarden_root_dir }}/backup/db.sqlite3'"
|
||
|
{% endif %}
|
||
5 years ago
|
mountpoint -q /home/lbkp/bitwarden_rs/ || mount -o bind,ro {{ bitwarden_root_dir }}/backup/ /home/lbkp/bitwarden_rs/
|