I'm running Debian & Ubuntu and I've been using this script running in a terminal for a while but I find I easily get obsessed with the price. Instead I'd rather get, say hourly, desktop notifications.

Is there a simple way to do this?

closed as off-topic by Salvador Dali, Stéphane Gimenez, dchapes, John T, Greg Hewgill Feb 9 '14 at 21:15

  • This question does not appear to be about Bitcoin within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    This question appears to be off-topic because it is about some particular script, not crytocurrencies in general – Salvador Dali Jan 10 '14 at 0:34
  • Agreed, this is technically programming so it might be better suited for stackoverflow.com. – Greg Hewgill Jan 10 '14 at 7:15
  • I was initially looking for a premade solution, the answer became programming-oriented when I couldn't find any. The question was never about the script, it was just some background to my question. – erb Jan 10 '14 at 8:53

Assuming your script is called btce_ticker.sh, the following line would do it:

while true; do btce_ticker.sh; sleep 3600; done

The sleep 3600 sleeps for an hour before looping around and running the script again.

  • I don't want a terminal notification, instead I'd like a desktop notification. I solved it but can't answer my own question yet (apparently a forced 8h delay) since I have <10 rep. The script is here however: gist.github.com/ErikBjare/8332113 – erb Jan 9 '14 at 10:36
  • @erb: I note that you didn't actually say "desktop" in your original question. – Greg Hewgill Jan 9 '14 at 20:04
  • Yeah I forgot to mention that, sorry. – erb Jan 9 '14 at 20:10

I modified the script and used notify-send to get what I wanted. I run the lightweight notification daemon xfce4-notifyd but most desktop environments (Gnome, KDE, Xfce) should have one preinstalled (for example Gnome's notification-daemon).

It depends on the jq command, so make sure you install it first using your package manager.

Here's the script:

# Requires jq

# Remember to chmod +x!
# Add the following cron-job (using "crontab -e") to run at hourly intervals:
#     0 * * * * export DISPLAY=:0.0 && /bin/bash <SCRIPT_PATH_GOES_HERE> > /dev/null 2>&1
# Change <SCRIPT_PATH_GOES_HERE> to the appropriate name

BTCE_PRICE="$(curl -s https://btc-e.com/api/2/btc_usd/ticker | jq '.ticker.last')"
MTGOX_PRICE="$(curl -s http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast | jq '.data.last.display' | cut -d "\"" -f 2)"

notify-send "MtGox:     $MTGOX_PRICE
BTC-e:      \$$BTCE_PRICE"

Also available here

In order to run it on hourly intervals add the following line to your crontab using crontab -e:

0 * * * * export DISPLAY=:0.0 && /bin/bash <SCRIPT_PATH_GOES_HERE> > /dev/null 2>&1

Not the answer you're looking for? Browse other questions tagged or ask your own question.