View Single Post
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#427
i have no idea why you not using shell as well as external tools
Code:
#!/bin/sh

# Warn in red if data left <20%

# Data usage in cyan if data left not <20%

tx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_tx_bytes)
rx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_rx_bytes)
total=$(($tx+$rx))
usage=$(gconftool -g /cellui/settings/datacounter/general/gprs_home_notification_period_UI)
totalMB=$((($tx+$rx)/1000000))
amount=$(($total*100/$usage))
if [ $amount -ge 80 ]
then
echo {{red}}"Data left < 20%"
else
echo {{cyan}}"Data used = $totalMB MB"
fi
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post: