1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00
mattermost_ynh/scripts/backup

77 lines
2.3 KiB
Text
Raw Normal View History

2015-11-18 17:22:55 +01:00
#!/bin/bash
2017-09-11 08:29:58 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
2021-01-11 23:46:48 +01:00
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
2017-09-11 08:29:58 +02:00
#=================================================
# LOAD SETTINGS
#=================================================
2021-01-11 23:46:48 +01:00
ynh_print_info --message="Loading installation settings..."
2017-09-11 12:05:16 +02:00
2017-09-11 08:29:58 +02:00
app=$YNH_APP_INSTANCE_NAME
2021-01-11 23:46:48 +01:00
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
2015-11-18 17:22:55 +01:00
2017-09-11 08:29:58 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
2017-09-11 08:29:58 +02:00
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
2015-11-18 17:22:55 +01:00
2021-01-11 23:46:48 +01:00
ynh_backup --src_path="$final_path"
2015-11-18 17:22:55 +01:00
#=================================================
# BACKUP THE APP DATA
#=================================================
2021-03-21 22:15:35 +01:00
ynh_backup --src_path="/home/yunohost.app/$app" --is_big
2017-09-11 08:29:58 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
# BACKUP THE NGINX CONFIGURATION
2017-09-11 08:29:58 +02:00
#=================================================
2015-11-18 17:22:55 +01:00
2021-01-11 23:46:48 +01:00
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2015-11-18 17:22:55 +01:00
2017-09-11 08:29:58 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
# BACKUP LOGROTATE
2017-09-11 08:29:58 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
ynh_backup --src_path="/etc/logrotate.d/$app"
2017-09-11 08:29:58 +02:00
#=================================================
# BACKUP SYSTEMD
2017-09-11 08:29:58 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP THE DATABASE
2021-01-11 23:46:48 +01:00
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$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)."