1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00
monitorix_ynh/scripts/change_url

53 lines
1.5 KiB
Text
Raw Normal View History

2017-07-21 22:11:45 +02:00
#!/bin/bash
#=================================================
# 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
source ./experimental_helper.sh
2017-07-21 22:11:45 +02:00
source ./_common.sh
# Retrive arguments
path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH:-'/'})
2017-07-21 22:11:45 +02:00
old_domain=$YNH_APP_OLD_DOMAIN
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
#=================================================
2017-07-21 22:11:45 +02:00
# STANDARD MODIFICATIONS
#=================================================
# 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
ynh_delete_file_checksum "/etc/nginx/conf.d/$old_domain.d/$app.conf"
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
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
2017-07-21 22:11:45 +02:00
fi
config_nginx
2017-07-21 22:11:45 +02:00
# Update monitorix configuration
config_monitorix
2018-05-01 21:00:07 +02:00
# Reload monitorix
# 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
systemctl stop monitorix.service
2018-05-01 21:00:07 +02:00
sleep 1
pkill -f "monitorix-httpd listening on" || true
ynh_check_starting ' - Ok, ready.' '/var/log/monitorix'