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

77 lines
2.6 KiB
Text
Raw Normal View History

2019-01-26 16:40:36 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-08-14 00:07:10 +02:00
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2019-01-26 16:40:36 +01:00
source ../settings/scripts/_common.sh
2019-08-14 00:07:10 +02:00
source /usr/share/yunohost/helpers
2019-01-26 16:40:36 +01:00
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
2019-08-14 00:07:10 +02:00
ynh_clean_setup () {
ynh_clean_check_starting
2019-01-26 16:40:36 +01:00
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Loading installation settings..."
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
2019-01-26 16:40:36 +01:00
#=================================================
# STANDARD BACKUP STEPS
#=================================================
2019-08-14 00:07:10 +02:00
# STOP SYSTEMD SERVICE
2019-01-26 16:40:36 +01:00
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Stopping a systemd service..."
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
ynh_systemd_action --service_name=$app --action="stop"
2019-01-26 16:40:36 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
# BACKUP THE APP MAIN DIR
2019-01-26 16:40:36 +01:00
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Backing up the main app directory..."
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
ynh_backup --src_path="$final_path"
2019-01-26 16:40:36 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
# BACKUP THE NGINX CONFIGURATION
2019-01-26 16:40:36 +01:00
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Backing up nginx web server configuration..."
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
#=================================================
# SPECIFIC BACKUP
2019-01-26 16:40:36 +01:00
#=================================================
# BACKUP SYSTEMD
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Backing up systemd configuration..."
2019-08-14 00:07:10 +02:00
ynh_backup --src_path="/etc/systemd/system/$app.service"
2019-01-26 16:40:36 +01:00
2019-08-14 00:07:10 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Starting a systemd service..."
2019-08-14 00:07:10 +02:00
ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
2019-01-26 16:40:36 +01:00
2019-08-18 00:02:04 +02:00
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last