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

69 lines
2.3 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
#=================================================
2021-02-25 23:05:04 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
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
#=================================================
2024-02-14 13:31:37 +01:00
#REMOVEME? ynh_clean_setup () {
2017-12-16 23:20:29 +01:00
ynh_clean_check_starting
}
2021-02-25 23:05:04 +01:00
# Exit if an error occurs during the execution of the script
2024-02-14 13:31:37 +01:00
#REMOVEME? ynh_abort_if_errors
2017-03-19 18:28:38 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2024-02-14 13:31:37 +01:00
#REMOVEME? ynh_print_info --message="Loading installation settings..."
2017-03-19 18:28:38 +01:00
2024-02-14 13:31:37 +01:00
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
2017-03-19 18:28:38 +01:00
2024-02-14 13:31:37 +01:00
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
2016-11-30 17:49:37 +01:00
2022-03-08 20:24:29 +01:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2023-08-03 02:55:11 +02:00
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path="systemd"
2022-03-08 20:24:29 +01:00
2017-03-19 18:28:38 +01:00
#=================================================
2020-12-03 18:24:29 +01:00
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
2017-03-19 18:28:38 +01:00
#=================================================
2019-01-13 17:49:15 +01:00
# BACKUP THE APP MAIN DIR
2017-03-19 18:28:38 +01:00
#=================================================
2024-02-14 13:31:37 +01:00
ynh_backup --src_path="$install_dir" --not_mandatory
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
#=================================================
2016-11-30 17:49:37 +01:00
2019-05-28 00:28:01 +02:00
ynh_backup --src_path="/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
2022-03-08 20:24:29 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2023-08-03 02:55:11 +02:00
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd"
2022-03-08 20:24:29 +01:00
2019-01-30 15:56:18 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-12-03 18:24:29 +01:00
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."