1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00
pgadmin_ynh/scripts/backup
2020-12-12 15:02:45 +01:00

47 lines
1.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# Import common cmd
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
# LOAD SETTINGS
ynh_print_info --message="Loading installation settings..."
final_path=$(ynh_app_setting_get --app $app --key final_path)
domain=$(ynh_app_setting_get --app $app --key domain)
db_name=$(ynh_app_setting_get --app $app --key db_name)
app_version=$(ynh_app_upstream_version)
app_main_version=$(echo $app_version | cut -d'-' -f1)
app_sub_version=$(echo $app_version | cut -d'-' -f2)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path "$final_path"
# Backup config
ynh_print_info --message="Backing configuration..."
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path "/etc/uwsgi/apps-available/$app.ini"
# Backup Data and LOG
ynh_print_info --message="Backing up data..."
ynh_backup --src_path "/var/lib/pgadmin"
ynh_print_info --message="Backing up log..."
ynh_backup --src_path "/var/log/pgadmin"
ynh_backup --src_path "/var/log/uwsgi/$app"
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."