mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Update remove
This commit is contained in:
parent
6ac41d8b60
commit
6e7aed28d3
1 changed files with 0 additions and 134 deletions
134
scripts/remove
134
scripts/remove
|
@ -1,134 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#domain=$(ynh_app_setting_get "$app" domain) #not used
|
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
|
||||||
db_name=$(ynh_app_setting_get "$app" db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
#final_path=$(ynh_app_setting_get "$app" final_path) #not used
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
|
||||||
|
|
||||||
yunohost service remove snmpd
|
|
||||||
yunohost service remove zabbix-server
|
|
||||||
yunohost service remove zabbix-agent
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
|
||||||
ynh_remove_fpm_config
|
|
||||||
|
|
||||||
systemctl reload php7.0-fpm
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
timeout 5 systemctl stop zabbix-server || killall zabbix_server
|
|
||||||
systemctl disable zabbix-server
|
|
||||||
killall zabbix_server
|
|
||||||
|
|
||||||
timeout 5 systemctl stop zabbix-agent || killall zabbix_agentd
|
|
||||||
systemctl disable zabbix-agent
|
|
||||||
killall zabbix_agentd
|
|
||||||
|
|
||||||
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#remove symlink
|
|
||||||
rm /var/www/zabbix
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_mysql_remove_db "$db_user" "$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
|
||||||
ynh_remove_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
|
||||||
ynh_remove_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
echo "Close port $port" >&2
|
|
||||||
yunohost firewall disallow TCP "$port" 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE CRON FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove a directory securely
|
|
||||||
ynh_secure_remove "/etc/zabbix"
|
|
||||||
|
|
||||||
# Remove the log files
|
|
||||||
ynh_secure_remove "/var/log/zabbix"
|
|
||||||
|
|
||||||
# Remove the pid/socket files
|
|
||||||
ynh_secure_remove "/run/zabbix"
|
|
||||||
|
|
||||||
# Remove the sudoers file
|
|
||||||
ynh_secure_remove "/etc/sudoers.d/zabbix"
|
|
||||||
|
|
||||||
#REMOVE NONFREE PART PATCH IF NEEDED (snmp-mibs-downloader (non-free) installed in version 1)
|
|
||||||
nonfreepackagelist=$(dpkg-query -W -f='${Section}\t${Package}\n' | grep ^non-free)
|
|
||||||
if [ $(echo $nonfreepackagelist | wc -l) -eq 1 ] && [ $(echo $nonfreepackagelist | grep -c "snmp-mibs-downloader") -eq 1 ] ;then
|
|
||||||
ynh_print_info "Removing snmp-mibs-downloader (non-free package)"
|
|
||||||
sed -i.$(date "+%m%d%y") 's/ snmp-mibs-downloader,//g' /var/lib/dpkg/status
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt purge snmp-mibs-downloader -y
|
|
||||||
if [ -f /etc/apt/sources.list.d/non-free.list ];then
|
|
||||||
ynh_secure_remove /etc/apt/sources.list.d/non-free.list
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete zabbix
|
|
Loading…
Add table
Reference in a new issue