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"
}
### 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; |