Notices


Reply
Thread Tools
coderus's Avatar
Posts: 6,068 | Thanked: 11,244 times | Joined on Nov 2011 @ Open Mobile Platform, Innopolis, Russia
#431
maybe {song}{song!No song} aha?
__________________
Twitter | Openrepos | GitHub | PayPal.Me
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#432
Originally Posted by coderus View Post
maybe {song}{song!No song} aha?
Thanks, that works. I guess something changed in the way this works with 1.7?
 
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#433
Originally Posted by coderus View Post
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
It doesn't work for me. I have 264 MB consumed of a total of 300 MB and i see "Data used = 264 MB" (in cyan). If i do: echo "$amount", it shows 0.
 
coderus's Avatar
Posts: 6,068 | Thanked: 11,244 times | Joined on Nov 2011 @ Open Mobile Platform, Innopolis, Russia
#434
checked on two N9s and it working
__________________
Twitter | Openrepos | GitHub | PayPal.Me
 
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#435
Originally Posted by coderus View Post
checked on two N9s and it working
But echo "$amount" = 0 is correct?.
 
coderus's Avatar
Posts: 6,068 | Thanked: 11,244 times | Joined on Nov 2011 @ Open Mobile Platform, Innopolis, Russia
#436
no. something wrong with you copy/paste script
__________________
Twitter | Openrepos | GitHub | PayPal.Me
 
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#437
Originally Posted by coderus View Post
no. something wrong with you copy/paste script
Ok, i chmod +x this script, is this correct or i need to chmod 775?.
 
coderus's Avatar
Posts: 6,068 | Thanked: 11,244 times | Joined on Nov 2011 @ Open Mobile Platform, Innopolis, Russia
#438
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#439
I found this: echo "$usage" = 1000,000,000. But usage is the total amount of MB that I have, right?, so usage should be 300,000,000 = 300 MB in total that i have. So I had to hardcode this part: amount = $ (($ total / (($ usage/1000) * 3))) to reach the correct result according to my total of 300 MB to consume.But, it is assumed that usage has to be the total MB to consume, right?. I don't know how to make it work without hardcoding it.
 
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#440
Originally Posted by coderus View Post
get my script here: https://dl.dropbox.com/u/26659227/harmattan/data.sh
It works in the way I described in the comment above, i had to hardcode the amount .
 

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

Thread Tools

 
Forum Jump


All times are GMT. The time now is 23:04.