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

73 lines
2.2 KiB
Text
Raw Normal View History

2016-08-15 15:38:50 +02:00
#!/bin/bash
2018-02-08 17:25:54 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
2020-10-11 23:46:18 +02:00
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
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)
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
2016-08-15 15:38:50 +02:00
2018-02-08 17:25:54 +01:00
#=================================================
2020-10-11 23:46:18 +02:00
# BACKUP THE APP MAIN DIR
2018-02-08 17:25:54 +01:00
#=================================================
2018-02-07 23:49:32 +01:00
ynh_backup "$final_path"
2016-08-15 15:38:50 +02:00
# Copy the data files
ynh_backup "$DATADIR"
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/${app}.service"
2016-08-15 15:38:50 +02:00
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP VARIOUS FILES
#=================================================
2018-02-08 11:42:15 +01:00
ynh_backup "/var/log/$app"
2020-10-11 23:46:18 +02:00
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
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)."