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

50 lines
1.4 KiB
Text
Raw Normal View History

2016-03-18 18:38:54 +01:00
#!/bin/bash
2018-08-14 22:18:22 +02:00
#=================================================
# GENERIC START
#=================================================
2016-03-18 18:38:54 +01:00
2020-11-17 23:55:57 +01:00
# Import common cmd
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
2018-08-14 22:18:22 +02:00
# Source YunoHost helpers
source /usr/share/yunohost/helpers
2016-03-18 18:38:54 +01:00
2018-08-14 22:18:22 +02:00
# Stop script if errors
ynh_abort_if_errors
2016-03-18 18:38:54 +01:00
ynh_script_progression --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)
2016-03-18 18:38:54 +01:00
2018-08-14 22:18:22 +02:00
#=================================================
# STANDARD BACKUP STEPS
#=================================================
2016-03-18 18:38:54 +01:00
ynh_script_progression --message="Backing up configuration..."
2018-08-14 22:18:22 +02:00
# BACKUP THE NGINX CONFIGURATION
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf"
2018-08-14 22:18:22 +02:00
# Backup SOGo config
ynh_backup --src_path "/etc/$app"
2018-08-14 22:18:22 +02:00
# Backup stunnel config
ynh_backup --src_path "/etc/stunnel/$app.conf"
2018-08-14 22:18:22 +02:00
# Backup Cron
ynh_backup --src_path "/etc/cron.d/$app"
# Backup Logs
ynh_script_progression --message="Backing up logs"
ynh_backup --src_path "/var/log/$app"
2018-08-14 22:18:22 +02:00
# BACKUP THE MYSQL DATABASE
ynh_script_progression --message="Backing up database"
2018-08-14 22:18:22 +02:00
ynh_mysql_dump_db "$db_name" > db.sql
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last