-
Notifications
You must be signed in to change notification settings - Fork 128
/
OneKeyFuck_OCPU.sh
82 lines (59 loc) · 1.8 KB
/
OneKeyFuck_OCPU.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
#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
cur_dir=$(pwd)
check() {
# check root
[[ $EUID -ne 0 ]] && echo -e "${red}错误:${plain} 必须使用root用户运行此脚本!\n" && exit 1
# check os
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
release="centos"
else
echo -e "${red}未检测到系统版本,请联系脚本作者!${plain}\n" && exit 1
fi
}
#main
Fuck_OCPU() {
Cores=$(cat /proc/cpuinfo| grep "processor"| wc -l )
echo -e "${green} ${Cores}Cores${plain} "
echo -e "${green}==========================${plain} "
echo "等待5S"
sleep 5
if [ -f /root/Fuck_OCPU.sh ]; then
echo "file found...开始执行 吃掉CPU"
bash Fuck_OCPU.sh ${Cores}
else
echo "no such file!-开始下载"
cd /root && wget -qO Fuck_OCPU.sh https://raw.githubusercontent.com/Mrmineduce21/Oracle_OneKey_Active/main/Fuck_OCPU.sh && chmod +X Fuck_OCPU.sh && bash Fuck_OCPU.sh ${Cores}
fi
}
install_base() {
echo -e "${yellow}install_base_系统为${release}${plain} "
if [[ x"${release}" == x"centos" ]]; then
yum install epel-release -y
sudo yum update
yum install cpulimit wget socat -y
else
sudo apt-get update
sudo apt-get install cpulimit wget socat -y
fi
}
echo -e "${green}开始运行${plain}"
check
install_base
echo -e "${green}依赖安装完成${plain}"
Fuck_OCPU