Last active
August 29, 2015 14:11
-
-
Save toshi0383/e319ebc5919721617c4c to your computer and use it in GitHub Desktop.
GL-06P の累計受信データ量を取得するシェル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="http://pocketwifi.home/api/monitoring/traffic-statistics" | |
response=`curl -s $URL` | |
PATTERN=TotalDownload | |
downloadByte=`echo "$response" \ | |
| grep $PATTERN \ | |
| sed -e "s/<TotalDownload>//g" -e "s~</TotalDownload>~~g"` | |
if [ ! $downloadByte ];then | |
exit 1; | |
fi | |
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