View Single Post
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#415
herno24,

My script for what you want:
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=`dc $total $usage / p`

if [ $(echo "$amount > 0.800" |bc) -eq 1 ]
then
echo {{red}}"Data left < 20%"
else
echo {{cyan}}"Data used = $totalMB MB"
fi
exit 1
Screenshots:






Edit: I hadn't read thp's post in the previous page; you can remove the {{cyan}} tag and add it to billboard instead so your data usage will be shown in whatever colour you want while the <20% warning will be in red always...

Last edited by thedead1440; 2013-01-04 at 03:26.
 

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