mirror of
https://framagit.org/YunoHost-Apps/gitea_ynh.git
synced 2024-12-22 17:45:05 +01:00
52 lines
1.8 KiB
Bash
52 lines
1.8 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Load common variables and helpers
|
|
source ../settings/scripts/experimental_helper.sh
|
|
source ../settings/scripts/_common.sh
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
# Retrieve app settings
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
if [[ ! "$(systemctl status $app.service)" =~ "Active: inactive (dead)" ]]; then
|
|
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service and with this command before to run the backup 'systemctl stop $app.service'"
|
|
fi
|
|
|
|
#=================================================
|
|
# STANDARD BACKUP STEPS
|
|
#=================================================
|
|
|
|
# Copy the app source files
|
|
ynh_script_progression --message="Backing up code..." --weight=3
|
|
ynh_backup --src_path "$final_path"
|
|
|
|
# Copy the data files
|
|
ynh_script_progression --message="Backing up user data..." --weight=10
|
|
ynh_backup --src_path "$DATADIR" --is_big=1
|
|
|
|
ynh_script_progression --message="Backing up configuration..."
|
|
|
|
# Copy the conf files
|
|
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
ynh_backup --src_path "/etc/systemd/system/${app}.service"
|
|
|
|
# Backup logs
|
|
ynh_script_progression --message="Backing up logs..."
|
|
ynh_backup --src_path "/var/log/$app"
|
|
|
|
# Dump the database
|
|
ynh_script_progression --message="Backing up database"
|
|
ynh_mysql_dump_db "$dbname" > ./db.sql
|
|
|
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|