-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove.sh
67 lines (48 loc) · 1.77 KB
/
remove.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
function version_redhat()
{
service zabbix-agent stop
yum remove zabbix-agent* -y
yum remove zabbix-release* -y
rm -rvf /etc/zabbix
}
function version_ubuntu_debian()
{
service zabbix-agent stop
apt remove zabbix-agent* -y
apt remove zabbix-release* -y
rm -rvf /etc/zabbix
}
function version_suse()
{
service zabbix-agent stop
zypper -n remove zabbix-agent*
zypper -n remove zabbix-release*
rm -rvf /etc/zabbix
}
echo Starting Zabbix-Agent Removal Script
echo ==========================================================
if [[ $(cat /etc/*release*) == *"redhat"* ]];
then echo Running zabbix-agent uninstall script for Red Hat Enterprise Linux Distribution....
version_redhat
elif [[ $(cat /etc/*release*) == *"CentOS"* ]];
then echo Running zabbix-agent uninstall script for CentOS Distribution....
version_redhat
elif [[ $(cat /etc/*release*) == *"ubuntu"* ]];
then echo Running zabbix-agent uninstall script for Ubuntu Distribution....
version_ubuntu_debian
elif [[ $(cat /etc/*release*) == *"debian"* ]];
then echo Running zabbix-agent uninstall script for Debian Distribution....
version_ubuntu_debian
elif [[ $(cat /etc/*release*) == *"SUSE"* ]];
then echo Running zabbix-agent uninstall script for SUSE Linux Distribution....
version_suse
elif [[ $(cat /etc/*release*) == *"Amazon Linux"* ]];
then echo Running zabbix-agent uninstall script for Amazon Linux Distribution....
version_redhat
else echo This script cannot be used for zabbix-agent removal on this machine && exit 0
fi
echo ==========================================================
echo Zabbix-Agent is Successfully Uninstalled and Removed from this machine
echo Host to be removed from Front End : $(hostname -f)
echo ==========================================================