From d8ae4e93a871d2d6d7914fc819ff23adc89e183d Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Sat, 9 May 2020 21:52:50 +0200 Subject: [PATCH] update backup, restore, change_url scripts --- scripts/backup | 20 -------------------- scripts/change_url | 24 +++--------------------- scripts/restore | 19 ------------------- 3 files changed, 3 insertions(+), 60 deletions(-) diff --git a/scripts/backup b/scripts/backup index d985aba..80032de 100755 --- a/scripts/backup +++ b/scripts/backup @@ -35,12 +35,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # STANDARD BACKUP STEPS #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -86,26 +80,12 @@ ynh_script_progression --message="Backing up logrotate configuration..." --time ynh_backup --src_path="/etc/logrotate.d/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= -ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1 - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # BACKUP A CRON FILE #================================================= ynh_backup --src_path="/etc/cron.d/$app" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 3f21bc8..bd17920 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,9 +30,9 @@ ynh_script_progression --message="Loading installation settings..." --time --wei final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -70,12 +70,6 @@ fi #================================================= # STANDARD MODIFICATIONS #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -105,21 +99,9 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/restore b/scripts/restore index fe4ac6a..deb65ac 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -102,27 +98,12 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RESTORE THE CRON FILE #=================================================