Advertisement
brianMc

Hughesnet Status Monitor v1.1 for Linux

Oct 20th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Queries Hughesnet modem for usage allowance information
  4. #Parses the info and displays the relevent information
  5.  
  6. info=$(curl -silent http://www.systemcontrolcenter.com/getdeviceinfo/info.bin | grep -e ^Any -e ^Bonus)
  7.  
  8. index=0
  9.  
  10. for word in $info
  11. do
  12.     amt="$(echo $word | tr -cd [:digit:]'\n')"
  13.     mb[index]=$(echo "scale=2; $amt/1000" | bc)
  14.     ((++index))
  15. done
  16. bold=$(tput bold)
  17. normal=$(tput sgr0)
  18. clear
  19. echo -e "${bold}\n**Hughesnet Status Monitor**"
  20. echo -e "${normal}\nAnytime data usage is from 8am - 2am"
  21. echo "---------------------------------------"
  22. echo "Anytime Data Allowance: "${mb[1]}"GB"
  23. echo "Anytime Data Remaining: "${mb[0]}"GB"
  24. echo "======================================="
  25. echo "Bonus bytes usage is from 2am - 8am"
  26. echo "---------------------------------------"
  27. echo "Bonus Bytes Allowance: "${mb[3]}"GB"
  28. echo -e "Bonus Bytes Remaining: "${mb[2]}"GB"
  29.  
  30. tt=$(curl -silent http://www.systemcontrolcenter.com/getdeviceinfo/info.bin | grep -e ^User -e ^TimeLeft)
  31.  
  32. index1=0
  33.  
  34. for word1 in $tt
  35. do
  36.     amt="$(echo $word1 | tr -cd [:digit:]'\n')"
  37.     tito[index1]=$amt
  38.     ((++index1))
  39. done
  40. time=$(echo "scale=0; (${tito[0]}/60)/24" | bc)
  41. token=$(echo "scale=2; ${tito[1]}/1000" | bc)
  42. anyMB=$(echo "scale=0; ${mb[0]}*1000" | bc)
  43. dailyUse=$(echo "scale=0; $anyMB/$time" | bc)
  44. echo "======================================="
  45. echo "Token Bytes Available: "$token"GB"
  46. echo -e "Days Until Refill: "$time
  47. echo -e "Safe Anytime Data Usage Per Day: "$dailyUse"MB"'\n\n'
  48. read -p "Press any key to close..." -n1 -s
  49. echo -e "\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement