Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
### your_cronjob.sh ####
btc=$(curl -s http://api.coindesk.com/v1/bpi/currentprice.json | python -c "import json, sys; print(int(json.load(sys.stdin)['bpi']['USD']['rate'].replace(',','').split('.')[0] ))")
ALERT_BTC=3000
if [ $(($btc + 1)) -gt $ALERT_BTC ];
then
echo "btc is greater than $ALERT_BTC";
push "BTC value is greater then $ALERT_BTC"
fi;

to ~/.bashrc or ~/.zshrc

push(){
    echo "Sending message to pushover. $1"
    curl https://api.pushover.net/1/messages.json -X POST \
        --data "token=xxxxxx&user=xxxxxx&message=$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.