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

Fix back-up script

This commit is contained in:
ericgaspar 2020-11-20 08:56:54 +01:00
parent 3a2be9d683
commit 520fad9304
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 56 additions and 16 deletions

View file

@ -3,36 +3,76 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
# Load common variables and helpers #=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
source ../settings/scripts/_common.sh app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings # Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# Copy the app source files ynh_backup --src_path="$final_path"
ynh_backup "$final_path"
# Copy the data files #=================================================
ynh_backup "$DATADIR" # BACKUP DATA FILES
#=================================================
# Copy the conf files ynh_backup --src_path="$DATADIR"
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup "/etc/systemd/system/${app}.service"
# Backup logs #=================================================
ynh_backup "/var/log/$app" # BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/${app}.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
# Dump the database
ynh_mysql_dump_db "$dbname" > ./db.sql ynh_mysql_dump_db "$dbname" > ./db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -90,4 +90,4 @@ yunohost service add "$app" --log "/var/log/$app/$app.log"
ynh_use_logrotate "/var/log/$app" ynh_use_logrotate "/var/log/$app"
# Reload services # Reload services
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log" ynh_clean_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"