-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
146 lines (136 loc) · 4.37 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
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
if which mkfs.ext4 > /dev/null ;then
if ls /dev/xvdb1 &> /dev/null;then
if cat /etc/fstab|grep /alidata > /dev/null ;then
if cat /etc/fstab|grep /alidata|grep ext3 > /dev/null ;then
sed -i "/\/alidata/d" /etc/fstab
fi
else
echo '/dev/xvdb1 /alidata ext4 defaults 0 0' >> /etc/fstab
fi
mount -a
fi
else
if ls /dev/xvdb1 &> /dev/null;then
if cat /etc/fstab|grep /alidata > /dev/null ;then
echo ""
else
echo '/dev/xvdb1 /alidata ext3 defaults 0 0' >> /etc/fstab
fi
mount -a
fi
fi
/etc/init.d/mysqld stop &> /dev/null
/etc/init.d/nginx stop &> /dev/null
/etc/init.d/php-fpm stop &> /dev/null
/etc/init.d/vsftpd stop &> /dev/null
/etc/init.d/httpd stop &> /dev/null
killall mysqld &> /dev/null
killall nginx &> /dev/null
killall httpd &> /dev/null
killall apache2 &> /dev/null
killall vsftpd &> /dev/null
killall php-fpm &> /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/php delete ok!"
rm -rf /alidata/server/php
echo "/alidata/server/php-* delete ok!"
rm -rf /alidata/server/php-*
echo "/alidata/server/nginx delete ok!"
rm -rf /alidata/server/nginx
echo "rm -rf /alidata/server/nginx-* delete ok!"
rm -rf /alidata/server/nginx-*
echo "/alidata/server/httpd delete ok!"
rm -rf /alidata/server/httpd
echo "/alidata/server/httpd-* delete ok!"
rm -rf /alidata/server/httpd-*
echo ""
echo "/alidata/log/php delete ok!"
rm -rf /alidata/log/php
echo "/alidata/log/mysql delete ok!"
rm -rf /alidata/log/mysql
echo "/alidata/log/nginx delete ok!"
rm -rf /alidata/log/nginx
echo "/alidata/log/httpd delete ok!"
rm -rf /alidata/log/httpd
echo ""
echo "/alidata/www/phpwind delete ok!"
rm -rf /alidata/www/phpwind
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 "/etc/init.d/nginx delete ok!"
rm -f /etc/init.d/nginx
echo "/etc/init.d/php-fpm delete ok!"
rm -r /etc/init.d/php-fpm
echo "/etc/init.d/httpd delete ok!"
rm -f /etc/init.d/httpd
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\/nginx.*/d" /etc/rc.d/rc.local
sed -i "/\/etc\/init\.d\/php-fpm.*/d" /etc/rc.d/rc.local
sed -i "/\/etc\/init\.d\/vsftpd.*/d" /etc/rc.d/rc.local
sed -i "/\/etc\/init\.d\/httpd.*/d" /etc/rc.d/rc.local
else
sed -i "/\/etc\/init\.d\/mysqld.*/d" /etc/rc.local
sed -i "/\/etc\/init\.d\/nginx.*/d" /etc/rc.local
sed -i "/\/etc\/init\.d\/php-fpm.*/d" /etc/rc.local
sed -i "/\/etc\/init\.d\/vsftpd.*/d" /etc/rc.local
sed -i "/\/etc\/init\.d\/httpd.*/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
cp -f ./ftp/config-ftp/rpm_ftp/* /etc/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!"