~anjan/public-inbox

Two scripts to check how many data you used monthly & daily. Needs vnstat to be install and vnstatd service running. v1 APPLIED

magdesign: 1
 Two scripts to check how many data you used monthly & daily. Needs vnstat to be install and vnstatd service running.

 2 files changed, 64 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~anjan/public-inbox/patches/49235/mbox | git am -3
Learn more about email & git

[PATCH] Two scripts to check how many data you used monthly & daily. Needs vnstat to be install and vnstatd service running. Export this patch

---
 scripts/datausage_gsm.sh  | 32 ++++++++++++++++++++++++++++++++
 scripts/datausage_wlan.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100755 scripts/datausage_gsm.sh
 create mode 100755 scripts/datausage_wlan.sh

diff --git a/scripts/datausage_gsm.sh b/scripts/datausage_gsm.sh
new file mode 100755
index 0000000..714e75a
--- /dev/null
+++ b/scripts/datausage_gsm.sh
@@ -0,0 +1,32 @@
#!/bin/sh
# title="$icon_modem_fourg gsm datausage"
# Author: magdesign
# License: MIT
# Description: Shows the gsm data usage
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "/usr/bin/sxmo_common.sh"

# needs vnstat and its service vnstatd to run
# to reset to 0, stop service and rm var/lib/vnstat/vnstat.db

# Query
ASKWLAN="vnstat -d --short -i wlan0"
ASKGSM="vnstat -d --short -i rmnet_ipa0"

# Styles the output for mobile
STRIP="awk 'NR ==6 {print \$1, \$8, \$9} NR ==5 {print \$1, \$8, \$9} NR ==4 {print \$1, \$8, \$9}'"
WLAN="echo WLAN:"
GSM="echo GSM:"

# execute the commands
WLANUSAGE="$(eval $ASKWLAN | eval $STRIP)"
GSMUSAGE="$(eval $ASKGSM | eval $STRIP)"

# uncomment to display in a new terminal and close it in 5s
#sxmo_terminal.sh -- bash -c "${GSM}&${GSMUSAGE}; exec bash" & PID=$!; sleep 5 && kill $PID

# display output with notify send
notify-send "GSM Usage" "$GSMUSAGE"

exit 0
diff --git a/scripts/datausage_wlan.sh b/scripts/datausage_wlan.sh
new file mode 100755
index 0000000..be9072f
--- /dev/null
+++ b/scripts/datausage_wlan.sh
@@ -0,0 +1,32 @@
#!/bin/sh
# title="$icon_rss wlan datausage"
# Author: magdesign
# License: MIT
# Description: Shows the wlan data usage
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "/usr/bin/sxmo_common.sh"

# needs vnstat and its service vnstatd to run
# to reset to 0, stop service and rm var/lib/vnstat/vnstat.db

# Query
ASKWLAN="vnstat -d --short -i wlan0"
ASKGSM="vnstat -d --short -i qrtr0"

# Styles the output for mobile
STRIP="awk 'NR ==6 {print \$1, \$8, \$9} NR ==5 {print \$1, \$8, \$9} NR ==4 {print \$1, \$8, \$9}'"
WLAN="echo WLAN:"
GSM="echo GSM:"

# execute the commands
WLANUSAGE="$(eval $ASKWLAN | eval $STRIP)"
GSMUSAGE="$(eval $ASKGSM | eval $STRIP)"

# uncomment to display in a new terminal and close it in 5s
#sxmo_terminal.sh -- bash -c "${WLAN}&${WLANUSAGE}; exec bash" & PID=$!; sleep 5 && kill $PID

# display output with notify send
notify-send "WLAN Usage" "$WLANUSAGE"

exit 0
-- 
2.43.0
Thanks!

To git.sr.ht:~anjan/sxmo-userscripts
   a0e38db..cc83da4  master -> maste