mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
68 lines
1.8 KiB
Bash
Executable file
68 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Stop script if errors
|
|
ynh_abort_if_errors
|
|
|
|
# Import common cmd
|
|
source ./experimental_helper.sh
|
|
source ./_common.sh
|
|
|
|
# Retrieve app settings
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
path=$(ynh_normalize_url_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)
|
|
|
|
# Stop services
|
|
systemctl stop monitorix.service
|
|
|
|
# Backup the current version of the app
|
|
ynh_backup_before_upgrade
|
|
ynh_clean_setup () {
|
|
# restore it if the upgrade fails
|
|
ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
|
|
# Download package and install it
|
|
get_install_source
|
|
|
|
# Update nginx config
|
|
config_nginx
|
|
|
|
# Update monitorix configuration
|
|
config_monitorix
|
|
|
|
# Add hook
|
|
mkdir -p /usr/share/yunohost/hooks/post_iptable_rules
|
|
cp ../conf/post_iptable_rules_hook /usr/share/yunohost/hooks/post_iptable_rules/50-$app
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
|
|
# Set access
|
|
set_permission
|
|
|
|
# Reload monitorix
|
|
# While we call "restart" sometime for unknown reason monitorix don't cleanly restart. Probably on the stop instruction the webserver is not stoped before the new start instruction.
|
|
# So this fix that
|
|
sudo systemctl stop monitorix.service
|
|
sleep 1
|
|
sudo systemctl start monitorix.service
|
|
sleep 10
|