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

73 lines
2.2 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 START
2017-03-19 18:28:38 +01:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2018-07-13 17:33:05 +02:00
source ../settings/scripts/_common.sh
2016-11-30 17:49:37 +01:00
source /usr/share/yunohost/helpers
2017-03-19 18:28:38 +01:00
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_clean_setup () {
2017-12-16 23:20:29 +01:00
ynh_clean_check_starting
}
ynh_abort_if_errors
2017-03-19 18:28:38 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Load settings" --weight=3
2017-03-19 18:28:38 +01:00
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
#=================================================
2019-01-13 17:49:15 +01:00
# BACKUP THE APP MAIN DIR
2017-03-19 18:28:38 +01:00
#=================================================
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Backup the app main dir" --weight=15
2017-03-19 18:28:38 +01:00
2019-01-13 17:49:15 +01:00
ynh_systemd_action --action=stop --service_name=jenkins
sleep 1
2017-03-19 18:28:38 +01:00
CHECK_SIZE "$final_path"
ynh_backup "$final_path"
2016-11-30 17:49:37 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
2019-01-13 17:49:15 +01:00
# BACKUP THE NGINX CONFIGURATION
2017-03-19 18:28:38 +01:00
#=================================================
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Backup nginx configuration"
2016-11-30 17:49:37 +01:00
ynh_backup "/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
#=================================================
2019-01-13 17:49:15 +01:00
# BACKUP THE JENKINS' BOOT CONFIG
2017-03-19 18:28:38 +01:00
#=================================================
2016-11-30 17:49:37 +01:00
ynh_backup /etc/default/$app
#=================================================
# CHECK JENKINS STARTING
#=================================================
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Restart Jenkins" --weight=20
2019-01-13 17:49:15 +01:00
# Wait for Jenkins to be fully started
ynh_systemd_action --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300"
2019-01-30 15:56:18 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup completed" --last