yunohost-gitea_ynh/scripts/backup
2019-08-01 14:01:59 +02:00

39 lines
987 B
Bash

#!/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
domain=$(ynh_app_setting_get --app $app --key domain)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# Copy the app source files
ynh_backup --src_path "$final_path"
# Copy the data files
ynh_backup --src_path "$DATADIR"
# 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_backup --src_path "/var/log/$app"
# Dump the database
ynh_mysql_dump_db "$dbname" > ./db.sql