limit-speed.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- ipinfo.io/ip);
  6. IZIN=$( curl https://raw.githubusercontent.com/alifnurmareta/premium/main/iptext.sh | grep $MYIP )
  7. if [ $MYIP = $IZIN ]; then
  8. clear
  9. echo -e "${green} Please Wait, Proses...${NC}"
  10. sleep 5
  11. else
  12. echo "User premium Only ,Sila Contact Admin Bot😘"
  13. exit 0
  14. fi
  15. clear
  16. Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
  17. Info="${Green_font_prefix}[ON]${Font_color_suffix}"
  18. Error="${Red_font_prefix}[OFF]${Font_color_suffix}"
  19. cek=$(cat /home/limit)
  20. NIC=$(ip -o $ANU -4 route show to default | awk '{print $5}');
  21. function start () {
  22. echo -e "Limit Speed All Service"
  23. read -p "Set maximum download rate (in Kbps): " down
  24. read -p "Set maximum upload rate (in Kbps): " up
  25. if [[ -z "$down" ]] && [[ -z "$up" ]]; then
  26. echo > /dev/null 2>&1
  27. else
  28. echo "Start Configuration"
  29. sleep 0.5
  30. wondershaper -a $NIC -d $down -u $up > /dev/null 2>&1
  31. systemctl enable --now wondershaper.service
  32. echo "start" > /home/limit
  33. echo "Done"
  34. fi
  35. }
  36. function stop () {
  37. wondershaper -ca $NIC
  38. systemctl stop wondershaper.service
  39. echo "Stop Configuration"
  40. sleep 0.5
  41. echo > /home/limit
  42. echo "Done"
  43. }
  44. if [[ "$cek" = "start" ]]; then
  45. sts="${Info}"
  46. else
  47. sts="${Error}"
  48. fi
  49. clear
  50. echo -e " =============================="
  51. echo -e " Limit Bandwidth Speed "
  52. echo -e " =============================="
  53. echo -e " Status $sts"
  54. echo -e " 1. Start Limit"
  55. echo -e " 2. Stop Limit"
  56. echo -e " Press CTRL+C to return"
  57. read -rp " Please Enter The Correct Number : " -e num
  58. if [[ "$num" = "1" ]]; then
  59. start
  60. elif [[ "$num" = "2" ]]; then
  61. stop
  62. else
  63. clear
  64. echo " You Entered The Wrong Number"
  65. menu
  66. fi