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?
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?
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 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:
#!/bin/sh
# 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