yunohost-gitea_ynh/scripts/backup

46 lines
1.3 KiB
Plaintext
Raw Normal View History

2018-02-25 21:45:24 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
# Retrieve app settings
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Loading installation settings..."
2019-06-09 21:05:14 +02:00
domain=$(ynh_app_setting_get --app $app --key domain)
2018-02-25 21:45:24 +01:00
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# Copy the app source files
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Backing up code..." --weight=3
2019-08-01 14:01:59 +02:00
ynh_backup --src_path "$final_path"
2018-02-25 21:45:24 +01:00
# Copy the data files
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Backing up user data..." --weight=10
2019-08-01 14:01:59 +02:00
ynh_backup --src_path "$DATADIR"
2018-02-25 21:45:24 +01:00
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Backing up configuration..."
2018-02-25 21:45:24 +01:00
# Copy the conf files
2019-08-01 14:01:59 +02:00
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup --src_path "/etc/systemd/system/${app}.service"
2018-02-25 21:45:24 +01:00
# Backup logs
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Backing up logs..."
2019-08-01 14:01:59 +02:00
ynh_backup --src_path "/var/log/$app"
2018-02-25 21:45:24 +01:00
# Dump the database
2019-09-10 22:43:45 +02:00
ynh_script_progression --message="Backing up database"
2019-06-09 21:05:14 +02:00
ynh_mysql_dump_db "$dbname" > ./db.sql