forked from helloxz/ccaa
-
Notifications
You must be signed in to change notification settings - Fork 1
/
uninstall.sh
84 lines (75 loc) · 2.2 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
#!/bin/bash
##### 一键卸载CCAA #####
##### 作者:xiaoz.me #####
##### 更新时间:2020-02-28 #####
#导入环境变量
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin
export PATH
#删除端口函数
function del_post() {
if [ -e "/etc/sysconfig/iptables" ]
then
sed -i '/^.*6080.*/'d /etc/sysconfig/iptables
sed -i '/^.*6081.*/'d /etc/sysconfig/iptables
sed -i '/^.*6800.*/'d /etc/sysconfig/iptables
sed -i '/^.*6998.*/'d /etc/sysconfig/iptables
sed -i '/^.*51413.*/'d /etc/sysconfig/iptables
service iptables save
service iptables restart
elif [ -e "/etc/firewalld/zones/public.xml" ]
then
firewall-cmd --zone=public --remove-port=6080/tcp --permanent
firewall-cmd --zone=public --remove-port=6081/tcp --permanent
firewall-cmd --zone=public --remove-port=6800/tcp --permanent
firewall-cmd --zone=public --remove-port=6998/tcp --permanent
firewall-cmd --zone=public --remove-port=51413/tcp --permanent
firewall-cmd --reload
elif [ -e "/etc/ufw/before.rules" ]
then
sudo ufw delete 6080/tcp
sudo ufw delete 6081/tcp
sudo ufw delete 6800/tcp
sudo ufw delete 6998/tcp
sudo ufw delete 51413/tcp
fi
}
#停止所有服务
kill -9 $(pgrep 'aria2c')
kill -9 $(pgrep 'ccaa_web')
kill -9 $(pgrep 'filebrowser')
kill -9 $(pgrep 'caddy')
systemctl disable aria2
systemctl disable ccaa_web
systemctl disable filebrowser
systemctl disable ccaa.service
#删除文件
rm -rf /etc/ccaa
rm -rf /usr/sbin/ccaa_web
rm -rf /usr/sbin/ccaa
rm -rf /usr/sbin/ccaa
rm -rf /usr/bin/aria2c
rm -rf aria2-1.*
rm -rf AriaNg*
rm -rf /usr/share/man/man1/aria2c.1
rm -rf /etc/ssl/certs/ca-certificates.crt
rm -rf /etc/systemd/system/aria2.service
rm -rf /etc/systemd/system/ccaa_web.service
rm -rf /etc/systemd/system/filebrowser.service
rm -rf /etc/systemd/system/ccaa.service
#删除filebrowser
rm -rf /usr/sbin/filebrowser
#删除日志
rm -rf /var/log/aria2.log
rm -rf /var/log/ccaa_web.log
rm -rf /var/log/fbrun.log
rm -rf /var/log/filebrowser.log
#删除用户和用户组
userdel ccaa
groupdel ccaa
#删除端口
del_post
echo "------------------------------------------------"
echo '卸载完成!'
echo "------------------------------------------------"
#删除自身
rm -rf ccaa-uninstall.sh