Aggancia questa barra allo schermo |  Disattiva gli effetti grafici

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.



Auto-disconnesione per abbonamenti a volume

Oggi, 12/02/2009, mi sono attivato la promozione "Naviga 3" con la quale si hanno a disposizione 50MB al giorno per 30 giorni. script

Com'è intuibile, oltre il raggiungimento dei 50MB verrebbe applicata la normale tariffazione svuotando il credito della sim prima di rendersene conto.
Per ovviare a questo inconveniente, anche grazie all'aiuto degli amici di slacky.eu, ho scritto 2 script, che possono essere sfruttati per esempio con kppp, che killano pppd al raggiungimento dei 50MB:

killpppd.sh

# (C) 2009, Andrea Peluso.

expr $1 \+ 0 1> /dev/null
TEST=$?
if [ $# -ne 1 -o $TEST -ne 0 ]; then
  echo -e "Uso: $0 [limite in MB]\n"
  echo "Script di auto-disconnessione per abbonamenti a volume."
  echo -e "(C) 2009, Andrea Peluso.\n"
  exit 1
fi
DATE=$(date +%Y%m%d)
echo $DATE > /tmp/date.tmp
BYTEBU=0
LIM=$(expr $1 \* 1000000)
if [ -r /tmp/$DATE ]; then
  BYTEBU=`expr $(cat /tmp/$DATE)`
  if [ "$BYTEBU" -ge "$LIM" ]; then
    kdialog --warningcontinuecancel "Oggi sono gia' stati consumati $(expr $BYTEBU / 1000000) MB ($(expr $BYTEBU / 1048576) MB).\nVuoi continuare comunque?" --title "KillPPP"
    if [ $? = 0 ]; then
      exit 0
    else sudo killall pppd
    fi
  fi
  kdialog --msgbox "Oggi sono gia' stati consumati $(expr $BYTEBU / 1000000) MB ($(expr $BYTEBU / 1048576) MB).\nTraffico residuo: `expr \( $LIM \- $BYTEBU \) / 1000000` MB (`expr \( $LIM \- $BYTEBU \) / 1048576` MB)." --title "KillPPP" &
fi
while [ true ]
do
  RX=`cat /sys/class/net/ppp0/statistics/rx_bytes`
  TX=`cat /sys/class/net/ppp0/statistics/tx_bytes`
  BYTETOT=$(expr $RX \+ $TX \+ $BYTEBU)
  if [ "$BYTETOT" -ge "$LIM" ]; then
    echo + >> /tmp/$DATE
    cat /sys/class/net/ppp0/statistics/rx_bytes >> /tmp/$DATE
    echo + >> /tmp/$DATE
    cat /sys/class/net/ppp0/statistics/tx_bytes >> /tmp/$DATE
    kdialog --yesno "Sono stati consumati $(expr $BYTETOT / 1000000) MB ($(expr $BYTETOT / 1048576) MB).\nVuoi terminare la connessione?" --title "KillPPP"
    if [ $? = 0 ]; then
      sudo killall pppd
    fi
    exit 0
  fi
  sleep 5
done
Scarica [.sh]    ...scaricato 5 volte, dimensione: 2 KB

savebyte.sh

# (C) 2009, Andrea Peluso.

expr $1 \+ 0 1> /dev/null
TEST=$?
if [ $# -ne 1 -o $TEST -ne 0 ]; then
  echo -e "Uso: ./killppp.sh [limite in MB]\n"
  echo "Script di auto-disconnessione per abbonamenti a volume."
  echo -e "(C) 2009, Andrea Peluso.\n"
  exit 1
fi
DATE=$(cat /tmp/date.tmp)
BYTEBU=0
LIM=$(expr $1 \* 1000000)
if [ -r /tmp/$DATE ]; then
  BYTEBU=`expr $(cat /tmp/$DATE)`
fi
echo + >> /tmp/$DATE
cat /sys/class/net/ppp0/statistics/rx_bytes >> /tmp/$DATE
echo + >> /tmp/$DATE
cat /sys/class/net/ppp0/statistics/tx_bytes >> /tmp/$DATE
RX=$(cat /sys/class/net/ppp0/statistics/rx_bytes)
TX=$(cat /sys/class/net/ppp0/statistics/tx_bytes)
BYTECUR=$(expr $RX \+ $TX)
BYTETOT=$(expr $RX \+ $TX \+ $BYTEBU)
kdialog --msgbox "Sono stati consumati:\n$(expr $BYTECUR / 1000000) MB ($(expr $BYTECUR / 1048576) MB) in questa sessione,\n$(expr $BYTETOT / 1000000) MB ($(expr $BYTETOT / 1048576) MB) in totale nella data odierna,\n`expr \( $LIM \- $BYTETOT \) / 1000000` (`expr \( $LIM \- $BYTETOT \) / 1048576` MB) rimasti." --title "KillPPP" &
rm /tmp/date.tmp
Scarica [.sh]    ...scaricato 5 volte, dimensione: 1 KB

Il primo va eseguito subito dopo l'avvenuta connessione e il secondo, subito prima della disconnessione; entrambi col limite del proprio abbonamento espresso in megabyte come opzione.

Per esempio:

/percorso/completo/killpppd.sh 50

e

/percorso/completo/savebyte.sh 50

...nel caso si abbiano 50 MB a disposizione.

Ho voluto pubblicarli qui, perché sono sicuro che serviranno a qualcuno.


Scritto da: Andrea Peluso (sya54M), . Aggiornato: .

Commenti

82 commenti

link

Sharron

https://is.gd/m4QSbl

link

Joey

https://bitbin.it/r5pU6REI/

link

Jefferson

https://is.gd/DZ9V5D

link

Debora

http://a.globus-kino.ru

Золото 17 серия

Dora

https://bitbin.it/nynD9KYM/

Папы 2022

Eve

http://bitly.com/papy-smotret-onlayn

Сказка о Хвосте Феи 259 серия

Ahmad

https://m.vk.com/video-86873619_171516410

Вдали от обезумевшей толпы

Otilia

http://bitly.com/30d6vp0

Link

Heidi

https://bitbin.it/jQQsfOfi/

Link

Camille

https://bitbin.it/nkfD5R6r/

Вечер с Владимиром Соловьевым

Stormy

https://bitly.com/vecher-s-vladimirom-solovevim

Вечер с Владимиром Соловьевым

Melvin

http://bitly.com/vecher-s-vladimirom-solovevim

z.globus-kino.ru

Tuyet

http://z.globus-kino.ru/

filmiwap.store

Jerrell

http://filmiwap.store/

Скачать порно

Rosalyn

https://m.pornoaut.me

Захар Беркут

Prince

https://bitly.com/zakharbercut

link

Maricruz

https://images.google.com.tj/url?q=http://cleantalkorg2.ru/article?2022-04-05

Неудержимые 4

Jamison

https://bitly.com/NEUDERZHIMYYE-4

Неудержимые 4

Stephania

https://bitly.com/NEUDERZHIMYYE-4

yutube

Kazuko

https://bitbin.it/H97xFmIs/

online cbd products

Boyd

https://www.uwtd.me/profile/ulyssesantone9/

cbd gummies 25mg

Clarissa

https://creafuture.ro/forum/profile/wardwemyss06994/

Link

Tonja

https://images.google.ru/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

online cbd gummies 25mg

Augustus

https://fdel.dk/community/profile/michalediederic/

cbd hemp oil

Justin

http://landauer-stimme.de/2022/04/22/precisely-what-is-cbd-and-what-are-its-health-and-fitness-benefits-6/

Парад Победы в Москве. 9 мая 2022 смотреть онлайн

Ramonita

https://kinoteatrzarya.ru/%d0%bf%d0%b0%d1%80%d0%b0%d0%b4-%d0%bf%d0%be%d0%b1%d0%b5%d0%b4%d1%8b-%d0%b2-%d0%bc%d0%be%d1%81%d0%ba%d0%b2%d0%b5-9-%d0%bc%d0%b0%d1%8f-2022-%d1%81%d0%bc%d0%be%d1%82%d1%80%d0%b5%d1%82%d1%8c-%d0%be%d0%bd_2a4a5623d.html

Парад Победы в Москве. 9 мая 2022 смотреть онлайн

Gina

https://kinoteatrzarya.ru/%d0%bf%d0%b0%d1%80%d0%b0%d0%b4-%d0%bf%d0%be%d0%b1%d0%b5%d0%b4%d1%8b-2022-%d1%81%d0%bc%d0%be%d1%82%d1%80%d0%b5%d1%82%d1%8c-%d0%be%d0%bd%d0%bb%d0%b0%d0%b9%d0%bd-09-05-2022_250bfd49d.html

Link

Abby

http://74.125.21.99/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

Link

Wendell

http://108.177.112.198/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

Link

Isabella

http://64.233.161.190/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

Link

Margarette

http://74.125.203.200/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

Link

Darci

http://172.217.25.3/url?q=https://bit.ly/velikolepnyy-vek-vse-seriy

Link

Gina

https://bit.ly/3N0Uadw

2022

Jeanette

https://bitbin.it/aGImpMPD/

XVIDEOS

Kristina

https://t.me/xvideos_xvideo

XVIDEOS

Frederic

http://ngocthuy.longbien.hanoi.gov.vn/thu-vien-anh?p_p_id=31_INSTANCE_QSSd2cWxrpzU&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_31_INSTANCE_QSSd2cWxrpzU_redirect=https://t.me/xvideos_xvideo&_31_INSTANCE_QSSd2cWxrpzU_struts_action=%2Fimage_gallery_display%2Fview&_31_INSTANCE_QSSd2cWxrpzU_folderId=877093

cbd oil

Ewan

https://kaafweb.com/what-is-cbd-and-what-are-its-health-advantages/11229/

XVIDEOS

George

https://bit.ly/Free-Videos-HD

XVIDEOS

Ulrike

https://geodesy.noaa.gov/cgi-bin/redirectM.prl?u=ngs.antcal&d=t.me/xvideos_xvideo&s=Web%20Comments%20/ANTCAL&b=Re%3A%20http%3A//www.ngs.noaa.gov%3A80/ANTCAL

порно мир

Gilberto

https://pornomirxxx.com

Link

Rhoda

http://google.net/url?q=https://bit.ly/dssmotretonline

Нулевой пациент 3 серия

Angeline

https://t.me/filmfilmfilmes/25

юрий подоляка последние новости

Lilla

https://bit.ly/podolyak-segodnya

Link

Andre

http://google.vg/url?q=https://bit.ly/dssmotretonline

Dow futures.

Ferdinand

http://onetoday-dev.sandbox.google.com.pl/url?q=https://bit.ly/Netflix-bez-VPN

Link

Randal

http://google.com.jo/url?q=https://bit.ly/dssmotretonline

Gamestop stock.

Anna

https://t.me/avdcotel

смотри ка

Marian

https://bit.ly/FILMFILMFILM

Уэльс Украина смотреть онлайн бесплатно

Jillian

http://bit.ly/uels-ukraina-smotret-onlayn-2022-06-05

Когда необходим прием психолога?

Silvia

https://vk.com/away.php?to=http%3A%2F%2Frussianmanagement.com&post=241113028_3&cc_key=

Психолога онлайн

Terry

http://google.com/url?q=http://batmanapollo.ru

cbd tincture 300mg

Jayden

https://www.mazafakas.com/user/profile/1505570

cbd topical cream for pain

Hester

http://www.dailymagazine.news/crime-forces-jersey-shore-town-to-close-beach-boardwalk-early-nid-1588387.html

tremella mushrooms benefits

Ignacio

http://www.geocraft.xyz/index.php/User:MickeyStarkey7

cbd gummies legal

Ruth

http://www.geocraft.xyz/index.php/User:RobertaUsher667

does cbd help with allergies

Nichole

https://kraftzone.tk/w/index.php?title=User:ShelleyMeador3

смотри сюда

Sophie

http://tinyurl.com/2795hvst

которое фильм занял на

Dennis

http://images.google.com.sv/url?q=http://netstate.ru/

смотри да

Helena

http://maps.google.gg/url?q=http://netstate.ru/

тор любовь и гром дата выхода

Margery

https://bit.ly/tor-lyubov-i-grom

кинотеатр мир

Kacey

http://maps.google.ro/url?q=http://netstate.ru

смотреть онлайн в хорошем качестве бесплатно фильмы

Hiram

http://bit.ly/smotret-onlayn-v-khoroshem-kachestve-besplatno-filmy

тор любовь и гром премьера

Lou

http://bit.ly/tor-lyubov-i-grom

смотреть онлайн бесплатно без регистрации фильмы

Sheila

http://tinyurl.com/29bshejs

what happened in donetsk

Iris

http://www.youtube.com/watch?v=pa1USenOB4w

київ останні новини

Selina

https://www.youtube.com/user/SuperSharij/videos

тор любовь и гром фильм 2022 киного

Chloe

http://bit.ly/tor-lyubov-i-grom

пацаны 3 сезон 4 серия скачать торрент

Brigida

https://bit.ly/pacany-4-sezon-1-seriya

site

Muoi

http://filmgoda.ru/film8/filmy-v-khoroshem-kachestve-smotrethd-kino-CG66.html

смотреть онлайн бесплатно фильмы смотреть онлайн в HD 1080 - 720

Charline

http://filmgoda.ru/film9/smotret-onlain-besplatno-filmysmotret-film-RG38.html

site

Kimberley

http://stat.netstate.ru/

site

Jackson

https://tinyurl.com/22m29ghq

site

Isobel

http://stat.netstate.ru/sitemap174.html

site

Robbie

https://bitbin.it/aOuSjapt/

site

Barbara

https://bitbin.it/VOD1tEgX/

site

Ivy

https://bitbin.it/aOuSjapt/

почасовая аренда кабинета психолога в москве

Johnette

https://t.me/abcduall/26

помогите найти хорошего психолога

Sabina

https://t.me/abcduall

дорамы детективы южная корея

Devin

https://bit.ly/dorama-doramy

смотреть онлайн в хорошем качестве бесплатно фильмы

Hermelinda

https://bit.ly/3qAIwwN

Клиническая психология

Erlinda

http://mgfmail.ru/

Эволюционная психология

Shelia

http://kremlin-team.ru/

I campi contrassegnati con * sono obbligatori.

Condividi sui tuoi social preferiti!

Telegram Facebook Linkedin Twitter Pinterest
.