View Single Post
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#414
Ok, i can see 248MB consumed in cyan but it should be displayed in red (because i have a total of 300 MB). Maybe an error in amount or in the IF condition?. This is my modification code:

Code:
#!/bin/sh

# Warn in red if data left <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))
consumed=$((total/1000000))
usage=$(gconftool -g /cellui/settings/datacounter/general/gprs_home_notification_period_UI)
amount=`dc $total $usage / p`

if [ $(echo "$amount > 0.800" |bc) -eq 1 ]
then
echo "{{red}}$consumed MB"
else
echo "{{cyan}}$consumed MB"
fi
exit 1