mirror of
https://github.com/YunoHost-Apps/sogo_ynh.git
synced 2024-09-03 20:26:07 +02:00
70 lines
2 KiB
Bash
Executable file
70 lines
2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Import common cmd
|
|
source ../settings/scripts/experimental_helper.sh
|
|
source ../settings/scripts/_common.sh
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Stop script if errors
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_print_info --message="Loading installation settings..."
|
|
|
|
# retrieve useful param
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
|
|
|
#=================================================
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
#=================================================
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
|
|
|
#=================================================
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
#=================================================
|
|
# BACKUP SOGO CONFIG
|
|
#=================================================
|
|
|
|
ynh_backup --src_path="/etc/$app"
|
|
|
|
#=================================================
|
|
# BACKUP STUNNEL CONFIG
|
|
#=================================================
|
|
|
|
ynh_backup --src_path="/etc/stunnel/$app.conf"
|
|
|
|
#=================================================
|
|
# BACKUP VARIOUS FILES
|
|
#=================================================
|
|
|
|
# Backup Cron
|
|
ynh_backup --src_path="/etc/cron.d/$app"
|
|
|
|
# Backup Logs
|
|
ynh_backup --src_path="/var/log/$app"
|
|
|
|
#=================================================
|
|
# BACKUP THE MYSQL DATABASE
|
|
#=================================================
|
|
ynh_print_info --message="Backing up database"
|
|
|
|
ynh_mysql_dump_db "$db_name" > db.sql
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|