2017-07-21 22:11:45 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
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
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Import common cmd
|
2018-01-31 16:07:43 +01:00
|
|
|
source ./experimental_helper.sh
|
2017-07-21 22:11:45 +02:00
|
|
|
source ./_common.sh
|
|
|
|
|
|
|
|
# Retrive arguments
|
2018-05-07 23:08:03 +02:00
|
|
|
path_url=$(ynh_normalize_url_path ${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
|
|
|
|
port=$(ynh_app_setting_get "$app" http_port)
|
|
|
|
nginx_status_port=$(ynh_app_setting_get "$app" nginx_status_port)
|
|
|
|
dbuser=$app
|
|
|
|
dbname=$app
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" 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
|
|
|
#=================================================
|
|
|
|
|
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-07 23:08:03 +02:00
|
|
|
old_file_path="/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
|
|
|
new_file_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
mv "$old_file_path" "$new_file_path"
|
|
|
|
|
|
|
|
# Change the checksum setting name
|
|
|
|
checksum_setting_old_name=checksum_${old_file_path//[\/ ]/_}
|
|
|
|
checksum_setting_new_name=checksum_${new_file_path//[\/ ]/_}
|
|
|
|
checksum_value=$(ynh_app_setting_get $app $checksum_setting_old_name)
|
|
|
|
ynh_app_setting_set $app $checksum_setting_new_name $checksum_value
|
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
|
|
|
|
2018-05-07 23:08:03 +02:00
|
|
|
# Update monitorix configuration
|
|
|
|
config_monitorix
|
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
|
|
|
|
ynh_check_starting ' - Ok, ready.' '/var/log/monitorix'
|