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/remove
2023-01-22 03:13:05 +01:00

53 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
# Source YunoHost helpers
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
# Retrieve app settings
domain=$(ynh_app_setting_get --app $app --key domain)
#=================================================
# STANDARD REMOVE
#=================================================
# Stop service
ynh_script_progression --message="Stoping services..."
systemctl stop monitorix.service
# Drop MySQL database and user
ynh_script_progression --message="Removing databases..."
dbname=$app
dbuser=$app
ynh_mysql_drop_db "$dbname" || true
ynh_mysql_drop_user "$dbuser" || true
# Remove data
ynh_print_info --message="Due of the backup core only feature the data directory in '/var/lib/monitorix' was not removed. It need to be removed manually to purge app user data."
# Remove nginx config
ynh_secure_remove --file="/etc/nginx/conf.d/monitorix_status.conf"
ynh_remove_nginx_config
# Remove init script
ynh_script_progression --message="Removing systemd units..."
ynh_remove_systemd_config
# Autoremove package
ynh_script_progression --message="Removing dependencies" --weight=10
ynh_remove_app_dependencies
ynh_package_autoremove monitorix
yunohost service remove monitorix
ynh_script_progression --message="Removal of $app completed" --last