-
Notifications
You must be signed in to change notification settings - Fork 3
/
uninstall.sh
115 lines (103 loc) · 3.04 KB
/
uninstall.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
#
#Created by PhpStorm.
#User: liumapp
#Email: liumapp.com@gmail.com
#homePage: http://www.liumapp.com
#Date: 6/13/17
#Time: 5:15 PM
#
if [ "$1" != "in" ];then
echo "Before cleaning the installation script environment !"
echo "Please backup your data !!"
read -p "Enter the y or Y to continue:" isY
if [ "${isY}" != "y" ] && [ "${isY}" != "Y" ];then
exit 1
fi
fi
mkdir -p /alidata
/etc/init.d/mysqld stop &> /dev/null
/etc/init.d/vsftpd stop &> /dev/null
killall mysqld &> /dev/null
killall vsftpd &> /dev/null
echo "--------> Clean up the installation environment"
rm -rf /usr/local/freetype.2.1.10
rm -rf /usr/local/libpng.1.2.50
rm -rf /usr/local/freetype.2.1.10
rm -rf /usr/local/libpng.1.2.50
rm -rf /usr/local/jpeg.6
echo ""
echo "--------> Delete directory"
echo "/alidata/server/mysql delete ok!"
rm -rf /alidata/server/mysql
echo "rm -rf /alidata/server/mysql-* delete ok!"
rm -rf /alidata/server/mysql-*
echo "/alidata/server/java delete ok!"
rm -rf /alidata/server/java
echo "/alidata/server/java-* delete ok!"
rm -rf /alidata/server/java-*
echo "/alidata/server/tomcat delete ok!"
rm -rf /alidata/server/tomcat
echo "rm -rf /alidata/server/tomcat-* delete ok!"
rm -rf /alidata/server/tomcat-*
echo ""
echo "/alidata/log delete ok!"
rm -rf /alidata/log
echo ""
echo "/alidata/www delete ok!"
rm -rf /alidata/www
echo "/alidata/init delete ok!"
rm -rf /alidata/init
echo ""
echo "--------> Delete file"
echo "/etc/my.cnf delete ok!"
rm -f /etc/my.cnf
echo "/etc/init.d/mysqld delete ok!"
rm -f /etc/init.d/mysqld
echo ""
ifrpm=$(cat /proc/version | grep -E "redhat|centos")
ifdpkg=$(cat /proc/version | grep -Ei "ubuntu|debian")
ifcentos=$(cat /proc/version | grep centos)
echo "--------> Clean up files"
echo "/etc/rc.local clean ok!"
if [ "$ifrpm" != "" ];then
if [ -L /etc/rc.local ];then
echo ""
else
\cp /etc/rc.local /etc/rc.local.bak
rm -rf /etc/rc.local
ln -s /etc/rc.d/rc.local /etc/rc.local
fi
sed -i "/\/etc\/init\.d\/mysqld.*/d" /etc/rc.d/rc.local
sed -i "/\/etc\/init\.d\/vsftpd.*/d" /etc/rc.d/rc.local
sed -i "/\/alidata\/init\/initPasswd\.sh.*/d" /etc/rc.d/rc.local
else
sed -i "/\/etc\/init\.d\/mysqld.*/d" /etc/rc.local
sed -i "/\/etc\/init\.d\/vsftpd.*/d" /etc/rc.local
sed -i "/\/alidata\/init\/initPasswd\.sh.*/d" /etc/rc.local
fi
echo ""
echo "/etc/profile clean ok!"
sed -i "/export PATH=\$PATH\:\/alidata\/server\/mysql\/bin.*/d" /etc/profile
source /etc/profile
echo ""
if [ "$ifrpm" != "" ];then
yum -y remove vsftpd &> /dev/null
rpm -e vsftpd
rm -f /etc/vsftpd/chroot_list
rm -f /etc/vsftpd/ftpusers
rm -f /etc/vsftpd/user_list
rm -f /etc/vsftpd/vsftpd.conf
else
apt-get -y remove vsftpd
rm -f /etc/vsftpd.conf
rm -f /etc/vsftpd.chroot_list
rm -f /etc/vsftpd.user_list
rm -rf /etc/pam.d/vsftpd
fi
echo "vsftpd remove ok!"
rm -rf /alidata/account.log
rm -rf /alidata/website-info.log
if [ "$1" != "in" ];then
bash
fi