1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00
synapse_ynh/scripts/backup

42 lines
1.1 KiB
Text
Raw Normal View History

2017-02-13 20:43:41 +01:00
#!/bin/bash
# Source YunoHost helpers
source /usr/share/yunohost/helpers
2017-02-13 20:43:41 +01:00
# Stop script if errors
ynh_abort_if_errors
2017-02-13 20:43:41 +01:00
# Import common cmd
source ../settings/scripts/_common.sh
source ../settings/scripts/psql.sh
2017-02-13 20:43:41 +01:00
# Retrieve arguments
domain=$(ynh_app_setting_get $app special_domain)
2017-10-21 01:31:04 +02:00
final_path="/opt/yunohost/matrix-synapse"
2017-02-13 20:43:41 +01:00
# Copy Nginx config
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
# Backup synapse config
ynh_backup "/etc/matrix-synapse" "synapse_config"
# Backup coturn server
ynh_backup "/etc/turnserver.conf" "coturn_config"
ynh_backup "/etc/default/coturn" "coturn_config_default"
2017-02-13 20:43:41 +01:00
# Backup synapse database
ynh_backup "/var/lib/matrix-synapse" "data" 1
# Backup Postgresql database
sudo su -c "pg_dump $synapse_db_name" postgres > ${YNH_CWD}/dump.sql
2017-02-13 20:43:41 +01:00
2017-10-21 01:31:04 +02:00
# Copy the logs
ynh_backup "/var/log/matrix-synapse" "log"
ynh_backup "/var/log/turnserver" "log_turnserver"
2017-10-21 01:31:04 +02:00
# Backup systemd service
ynh_backup "/etc/default/matrix-synapse"
2017-10-21 01:31:04 +02:00
ynh_backup "/etc/systemd/system/matrix-synapse.service"
# Backup synapse binary
ynh_backup "$final_path" "bin"