1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grafana_ynh.git synced 2024-09-03 20:36:29 +02:00
grafana_ynh/scripts/remove

56 lines
1.9 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status grafana-server >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove grafana-server
yunohost service remove influxdb
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# If NetData is installed, configure it not to feed InfluxDB any more
netdata_conf="/var/www/netdata/etc/netdata/exporting.conf"
if [[ -f "$netdata_conf" ]] ; then
sed -i '/^\[exporting:global\]$/,/^\[/ {
s/enabled = yes/enabled = no/
s/update every = 60/# update every = 10/
}' $netdata_conf
fi
ynh_secure_remove --file="/etc/grafana/grafana.ini"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last