1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jenkins_ynh.git synced 2024-09-03 19:26:18 +02:00
jenkins_ynh/scripts/backup

55 lines
1.7 KiB
Text
Raw Normal View History

2016-11-30 17:49:37 +01:00
#!/bin/bash
2017-03-19 18:28:38 +01:00
#=================================================
# GENERIC STARTING
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
2016-11-30 17:49:37 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-03-19 22:50:12 +01:00
if [ ! -e _common.sh ]; then
2017-03-19 18:28:38 +01:00
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
2017-03-19 22:50:12 +01:00
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
2017-03-19 18:28:38 +01:00
fi
2017-03-19 22:50:12 +01:00
source _common.sh
2016-11-30 17:49:37 +01:00
source /usr/share/yunohost/helpers
2017-03-19 18:28:38 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
2016-11-30 17:55:46 +01:00
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
2016-11-30 17:49:37 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE MAIN DIR OF THE APP
#=================================================
CHECK_SIZE "$final_path"
2017-06-13 19:11:22 +02:00
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path"
2016-11-30 17:49:37 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
2016-11-30 17:49:37 +01:00
2017-06-13 19:11:22 +02:00
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
2016-11-30 17:49:37 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP OF THE JENKINS' BOOT CONFIG
#=================================================
2016-11-30 17:49:37 +01:00
2017-06-13 19:11:22 +02:00
ynh_backup /etc/default/$app "${YNH_APP_BACKUP_DIR}/etc/default/$app"