1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/bin/bash
- clear
- 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"
- Info="${Green_font_prefix}[ON]${Font_color_suffix}"
- Error="${Red_font_prefix}[OFF]${Font_color_suffix}"
- cek=$(cat /home/limit)
- NIC=$(ip -o $ANU -4 route show to default | awk '{print $5}');
- function start () {
- echo -e "Limit Speed All Service"
- read -p "Set maximum download rate (in Kbps): " down
- read -p "Set maximum upload rate (in Kbps): " up
- if [[ -z "$down" ]] && [[ -z "$up" ]]; then
- echo > /dev/null 2>&1
- else
- echo "Start Configuration"
- sleep 0.5
- wondershaper -a $NIC -d $down -u $up > /dev/null 2>&1
- systemctl enable --now wondershaper.service
- echo "start" > /home/limit
- echo "Done"
- fi
- }
- function stop () {
- wondershaper -ca $NIC
- systemctl stop wondershaper.service
- echo "Stop Configuration"
- sleep 0.5
- echo > /home/limit
- echo "Done"
- }
- if [[ "$cek" = "start" ]]; then
- sts="${Info}"
- else
- sts="${Error}"
- fi
- clear
- echo -e " ==============================" | lolcat
- echo -e " Limit Bandwidth Speed "
- echo -e " ==============================" | lolcat
- echo -e " Status $sts"
- echo -e " 1. Start Limit"
- echo -e " 2. Stop Limit"
- echo -e " Press CTRL+C to return" | lolcat
- read -rp " Please Enter The Correct Number : " -e num
- if [[ "$num" = "1" ]]; then
- start
- elif [[ "$num" = "2" ]]; then
- stop
- else
- clear
- echo " You Entered The Wrong Number" | lolcat
- menu
- fi
|