forked from Shellgate/tcp_optimization_bbr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbr.sh
56 lines (50 loc) · 1.63 KB
/
bbr.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
#!/bin/bash
project="TCP Optimization BBR"
backup_path="/etc/sysctl.conf"
new_file_url="https://raw.githubusercontent.com/Shellgate/tcp_optimization_bbr/main/sysctl.conf"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
display_info() {
echo -e "\n=== ${GREEN}$project${NC} ==="
echo -e "${RED}System Information:${NC}"
echo -e "+------------------------+"
echo -e "| OS: $(lsb_release -d | cut -f2) |"
echo -e "| CPU: $(grep 'model name' /proc/cpuinfo | head -n1 | cut -d' ' -f3-) |"
echo -e "| RAM: $(free -m | awk '/Mem/ {print $2 " MB"}') |"
echo -e "+------------------------+"
}
prompt_restart() {
read -p "Restart the system? (y/n): " restart_choice
case $restart_choice in
[Yy]) reboot ;;
[Nn]) echo "No restart. Exiting." ;;
*) echo "Invalid choice. No restart. Exiting." ;;
esac
}
display_info
options=("Install Script" "Restore Initial Backup" "Exit")
PS3="Select an option: "
select option in "${options[@]}"; do
case $REPLY in
1)
cp "$backup_path" "$backup_path.bak"
echo "Downloading the new file..."
curl -sSfL "$new_file_url" -o "$backup_path" --progress-bar
echo -e "${GREEN}File replaced, backup created.${NC}"
prompt_restart
break
;;
2)
cp "$backup_path.bak" "$backup_path"
echo -e "${GREEN}File restored from initial backup.${NC}"
prompt_restart
break
;;
3)
echo -e "${RED}Exiting.${NC}"
break
;;
*) echo "Invalid choice. Please select again." ;;
esac
done