You are not logged in.

#1 2011-06-30 10:47:28

JimmySJ84
Member
Registered: 2010-07-23
Posts: 12

Script to display VoipCheap (or similar) credit in Conky

Hello,

This is not a guide. All I want to do is to try to be useful for the ArchLinux community sharing this work.

Using this script you will be able to display your residual VoipCheap credit and the free days remaining in your conky.

It should also work with other similar services including voipstunt, poivy, etc.

Be aware that your account credentials need to be written in the script in order to run correctly.

1) create a script (voipcheap.sh) with the code below replacing the credentials with your data

#!/bin/bash 
CRED='username=USER&password=PASSWORD'
FILTER='euro'
URL='https://www.voipcheap.com/myaccount/index.php'
SERVICE='Voipcheap'
/usr/bin/wget -q --no-check-certificate --keep-session-cookies --save-cookies /tmp/vs_cookies.txt --post-data="$CRED" -O /tmp/vs_credit "$URL"
/usr/bin/wget -q --no-check-certificate --load-cookies /tmp/vs_cookies.txt --post-data='part=menu&justloggedin=true' -O /tmp/vs_credit "$URL"
credit=$(grep -i $FILTER /tmp/vs_credit) 
days=$(grep -i Freedays /tmp/vs_credit)
echo $credit >/tmp/credit
echo $days >/tmp/days

2) move the script to /etc/cron.hourly/ and give the right permissions:

chmod +x voipcheap.sh

3) add the following lines to your conkyrc

Voipcheap ${hr 2}

Credit: ${execi 300 cat /tmp/credit | cut -c13-17} €

Free days: ${execi 300 cat /tmp/days | cut -c94-96}

4) Enjoy!

I have been testing for few hours and seems to work correctly

Thanks to (http://www.voipandhack.it/archives/linu … -voipstunt)

Ciao

Salvo

P.S.

it depends on wget and curl

Last edited by JimmySJ84 (2011-06-30 17:05:42)

Offline

#2 2011-06-30 13:11:46

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Script to display VoipCheap (or similar) credit in Conky

can you run it with -x?

/bin/bash -x ./script

and post the output (hide the credentials though)

Offline

#3 2011-06-30 17:07:24

JimmySJ84
Member
Registered: 2010-07-23
Posts: 12

Re: Script to display VoipCheap (or similar) credit in Conky

@oIiver. I manage to finish the script. thanks anyway for your help

Offline

Board footer

Powered by FluxBB