Advertisement
asterolomaster

speedtest.sh

Jun 2nd, 2018
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. source /root/config
  4.  
  5. speed=$(/usr/bin/speedtest-cli --csv)
  6. ping=$(echo ${speed} | cut -d ',' -f 6 | cut -d '.' -f 1)
  7. down=$(echo ${speed} | cut -d ',' -f 7 | cut -d '.' -f 1)
  8. up=$(echo ${speed} | cut -d ',' -f 8 | cut -d '.' -f 1)
  9.  
  10.  
  11.  
  12. request="INSERT INTO stats.speed VALUES (NULL, CURRENT_TIMESTAMP, '$apteka', '$ping', '$up', '$down');"
  13.  
  14. echo $request |  /usr/bin/ssh -p ${sshport} pi@${host}  /usr/bin/mysql -upi
  15.  
  16. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement