forked from centos-bz/ezhttp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
99 lines (87 loc) · 2.43 KB
/
uninstall.sh
File metadata and controls
99 lines (87 loc) · 2.43 KB
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
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================
# SYSTEM REQUIRED: Linux
# DESCRIPTION: automatic deploy your linux
# AUTHOR: Zhu Maohai.
# website: http://www.centos.bz/ezhttp/
#===============================================================================
cur_dir=`pwd`
#大写转换成小写
upcase_to_lowcase(){
words=$1
echo $words | tr '[A-Z]' '[a-z]'
}
#关闭开机启动
boot_stop(){
if [ "`check_sys_version`" == "debian" ];then
update-rc.d -f $1 remove
elif [ "`check_sys_version`" == "centos" ];then
chkconfig $1 off
fi
}
uninstall(){
if [ ! -s "/tmp/ezhttp_info_do_not_del" ];then
echo "/tmp/ezhttp_info_do_not_del not found,uninstall failed."
exit 1
fi
. /tmp/ezhttp_info_do_not_del
if [ "$depends_prefix" != "" ];then
echo "removing depends components.."
rm -rf "$depends_prefix" && echo "Sucess"
fi
if [ "$nginx_location" != "" ];then
echo "uninstalling nginx"
/etc/init.d/nginx stop
boot_stop nginx
rm -f /etc/init.d/nginx
rm -rf "$nginx_location" && echo "Sucess"
fi
if [ "$apache_location" != "" ];then
echo "uninstalling apache"
/etc/init.d/httpd stop
boot_stop httpd
rm -f /etc/init.d/httpd
rm -rf "$apache_location" && echo "Sucess"
fi
if [ "$mysql_location" != "" ];then
echo "uninstalling mysql"
/etc/init.d/mysqld stop
boot_stop mysqld
rm -f /etc/init.d/mysqld
rm -rf "$mysql_location" && echo "Sucess"
fi
if [ "$php_location" != "" ];then
echo "uninstalling php"
/etc/init.d/php-fpm stop
boot_stop php-fpm
rm -f /etc/init.d/php-fpm
rm -rf "$php_location" && echo "Sucess"
fi
if [ "$memcached_location" != "" ];then
echo "uninstalling memcached"
/etc/init.d/memcached stop
boot_stop memcached
rm -f /etc/init.d/memcached
rm -rf "$memcached_location" && echo "Sucess"
fi
if [ "$pureftpd_location" != "" ];then
echo "uninstalling pureftpd"
/etc/init.d/pureftpd stop
boot_stop pureftpd
rm -f /etc/init.d/pureftpd
rm -rf "$pureftpd_location" && echo "Sucess"
fi
chattr -a /tmp/ezhttp_info_do_not_del && rm -f /tmp/ezhttp_info_do_not_del
}
while true
do
read -p "Are you sure uninstall ezhttp(include nginx apache mysql php memcached pureftpd etc.)? [N/y]? " uninstall
uninstall="`upcase_to_lowcase $uninstall`"
case $uninstall in
y) uninstall ; break;;
n) break;;
*) echo "input error";;
esac
done