mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
60 lines
No EOL
1.7 KiB
Bash
Executable file
60 lines
No EOL
1.7 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 ../settings/scripts/experimental_helper.sh
|
|
source ../settings/scripts/_common.sh
|
|
|
|
# Retrieve old app settings
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
|
|
|
|
# Check domain/path availability
|
|
ynh_webpath_available $domain $path_url || ynh_die "$domain/$path_url is not available, please use an other domain or path."
|
|
|
|
#=================================================
|
|
# STANDARD RESTORATION STEPS
|
|
#=================================================
|
|
|
|
# Install package
|
|
install_dependances
|
|
|
|
# Download package and install it
|
|
get_install_source
|
|
|
|
# Create user for database
|
|
dbuser=$app
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
ynh_mysql_create_user $dbuser $dbpass
|
|
|
|
# Restore all config and data
|
|
ynh_secure_remove /etc/monitorix # we remove the directory because if it is not empty the ynh_restore cmd fail
|
|
ynh_secure_remove /var/lib/monitorix
|
|
ynh_restore
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
|
|
# Set access
|
|
set_permission
|
|
|
|
# Reload nginx
|
|
systemctl reload nginx.service
|
|
|
|
# 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
|
|
# So this fix that
|
|
systemctl stop monitorix.service
|
|
sleep 1
|
|
pkill -f "monitorix-httpd listening on" || true
|
|
ynh_check_starting ' - Ok, ready.' '/var/log/monitorix' |