Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created November 30, 2014 12:15
Show Gist options
  • Save toshi0383/8fa3a07e516f58ee5db8 to your computer and use it in GitHub Desktop.
Save toshi0383/8fa3a07e516f58ee5db8 to your computer and use it in GitHub Desktop.
ポケットWifi(EMOBILE GL06P) の受信データ量合計を取得するシェル ref: http://qiita.com/toshi0383/items/8f7de60be27b51a77c81
$ ./wifilog.sh
[2014/11/30 20:59:36]: 308 GB
00 * * * * ~/Settings/bin/wifilog.sh >> ~/Settings/log/wifi.log
#!/bin/bash
URL="http://pocketwifi.home/api/monitoring/traffic-statistics"
downloadByte=`curl $URL 2> /dev/null \
| grep TotalDownload \
| sed -e "s/<TotalDownload>//g" -e "s~</TotalDownload>~~g"`
downloadGigaByte=`expr $downloadByte / 1024 / 1024 / 1024` #切り捨て御免
echo "["`date "+%Y/%m/%d %H:%M:%S"`"]:" $downloadGigaByte "GB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment