View Single Post
Posts: 443 | Thanked: 282 times | Joined on Oct 2011 @ Grenoble, France
#408
Originally Posted by herno24 View Post
I modified the last thedead1440's script to display the amount of MB consumed in red if they reach 80% of total MB or else in cyan if this value is not reached. I don't know how to program in this language so what I did must be very ugly haha, but is it correct?. Thanks!.

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))
usage=$(gconftool -g /cellui/settings/datacounter/general/gprs_home_notification_period_UI)
amount=`dc $total $usage / p`

consumed=$((total/1000000))
reply= (echo "$amount > 0.800" |bc)

if [ $(reply) -eq 1 ]
then
echo {{red}}"$consumed MB"
else
echo {{cyan}}"$consumed MB"
fi
exit 1
I have a problem with your script thedead. Nothing is displayed by bilboard ... and if I make : sh "your script"
I get
No value set for /cellui/settings/datacounter/transfer/gprs_home_tx_bytes.
Any ideas?

Edit: my mistake a "y" has been introduced during my difficult work to copy the script lol

Last edited by mousse04; 2013-01-03 at 22:11.