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/upgrade

53 lines
1.5 KiB
Text
Raw Normal View History

2017-01-05 23:37:07 +01:00
#!/bin/bash
# Import common cmd
source ./_common.sh
# Init script
init_script
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
http_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)
# Correct path if it is not correct
2017-01-31 21:26:13 +01:00
CHECK_PATH
2017-01-05 23:37:07 +01:00
# Download package
get_source
# Update package
sudo dpkg -i /tmp/monitorix.deb
sudo rm -rf /etc/monitorix/conf.d/00-debian.conf
# Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf
sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
sed -i "s@SERVICE_PORT@$http_port@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
# Add special hostname for monitorix status
nginx_status_conf=../conf/nginx_status.conf
sed -i "s@PORT@$nginx_status_port@g" $nginx_status_conf
sudo cp $nginx_status_conf /etc/nginx/conf.d/monitorix_status.conf
# Update monitorix configuration
monitorix_conf=../conf/monitorix.conf
sed -i "s@SERVICE_PORT@$http_port@g" $monitorix_conf
sed -i "s@YNH_DOMAIN@$domain@g" $monitorix_conf
sed -i "s@NGINX_STATUS_PORT@$nginx_status_port@g" $monitorix_conf
sed -i "s@YNH_WWW_PATH@$path@g" $monitorix_conf
sed -i "s@MYSQL_USER@$dbuser@g" $monitorix_conf
sed -i "s@MYSQL_PASSWORD@$dbpass@g" $monitorix_conf
sudo cp $monitorix_conf /etc/monitorix/monitorix.conf
# Reload services
sudo service monitorix restart
2017-05-26 15:02:19 +02:00
sudo yunohost app ssowatconf
sudo service nginx reload