2017-07-21 22:11:45 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-17 23:37:38 +01:00
|
|
|
# Import common cmd
|
|
|
|
source ./experimental_helper.sh
|
|
|
|
source ./_common.sh
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-08-14 18:41:01 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Retrive arguments
|
2019-06-07 23:09:30 +02:00
|
|
|
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH)
|
2017-07-21 22:11:45 +02:00
|
|
|
old_domain=$YNH_APP_OLD_DOMAIN
|
2018-05-07 23:08:03 +02:00
|
|
|
domain=$YNH_APP_NEW_DOMAIN
|
2019-06-07 23:09:30 +02:00
|
|
|
port=$(ynh_app_setting_get --app $app --key http_port)
|
|
|
|
nginx_status_port=$(ynh_app_setting_get --app $app --key nginx_status_port)
|
2018-05-07 23:08:03 +02:00
|
|
|
dbuser=$app
|
|
|
|
dbname=$app
|
2019-06-07 23:09:30 +02:00
|
|
|
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
2017-07-21 22:11:45 +02:00
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
2017-07-21 22:11:45 +02:00
|
|
|
# STANDARD MODIFICATIONS
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Updating nginx configuration..."
|
|
|
|
|
2018-05-07 23:08:03 +02:00
|
|
|
# Update nginx config
|
|
|
|
if [ "$old_domain" != "$domain" ]
|
2017-07-21 22:11:45 +02:00
|
|
|
then
|
2018-05-19 20:44:15 +02:00
|
|
|
# Delete file checksum for the old conf file location
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
2018-05-19 20:44:15 +02:00
|
|
|
|
|
|
|
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
# Store file checksum for the new config file location
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-07-21 22:11:45 +02:00
|
|
|
fi
|
2018-05-07 23:08:03 +02:00
|
|
|
config_nginx
|
2017-07-21 22:11:45 +02:00
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Updating monitorix configuration..."
|
|
|
|
|
2018-05-07 23:08:03 +02:00
|
|
|
# Update monitorix configuration
|
|
|
|
config_monitorix
|
2018-05-01 21:00:07 +02:00
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Restarting monitorix services..." --weight=3
|
2018-05-01 21:00:07 +02:00
|
|
|
# Reload monitorix
|
2018-05-07 23:08:03 +02:00
|
|
|
# While we stop monitorix sometime the built-in web server is not stopped cleanly. So are sure that everything is cleanly stoped by that
|
2018-05-01 21:00:07 +02:00
|
|
|
# So this fix that
|
2018-05-07 23:08:03 +02:00
|
|
|
systemctl stop monitorix.service
|
2018-05-01 21:00:07 +02:00
|
|
|
sleep 1
|
2018-05-07 23:08:03 +02:00
|
|
|
pkill -f "monitorix-httpd listening on" || true
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_systemd_action -l ' - Ok, ready.' -p '/var/log/monitorix'
|
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|