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:
parent
3a2be9d683
commit
520fad9304
2 changed files with 56 additions and 16 deletions
|
@ -3,36 +3,76 @@
|
|||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
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
|
||||
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
|
||||
#=================================================
|
||||
|
||||
# Copy the app source files
|
||||
ynh_backup "$final_path"
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
# Copy the data files
|
||||
ynh_backup "$DATADIR"
|
||||
#=================================================
|
||||
# BACKUP DATA FILES
|
||||
#=================================================
|
||||
|
||||
# Copy the conf files
|
||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
ynh_backup "/etc/systemd/system/${app}.service"
|
||||
ynh_backup --src_path="$DATADIR"
|
||||
|
||||
# Backup logs
|
||||
ynh_backup "/var/log/$app"
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Dump the database
|
||||
ynh_mysql_dump_db "$dbname" > ./db.sql
|
||||
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..."
|
||||
|
||||
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)."
|
||||
|
|
|
@ -90,4 +90,4 @@ yunohost service add "$app" --log "/var/log/$app/$app.log"
|
|||
ynh_use_logrotate "/var/log/$app"
|
||||
|
||||
# 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"
|
||||
|
|
Loading…
Reference in a new issue