Created
June 12, 2011 09:11
-
-
Save disq/1021366 to your computer and use it in GitHub Desktop.
Script to send e-mail on new transactions in bitcoin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RET=`/usr/local/bin/bitcoind --rpcconnect listtransactions` | |
RETCNT=`echo ${RET}|php -r '$x = file_get_contents("php://stdin");$a=json_decode($x);echo count($a);'` | |
LASTCNT=`cat ~/gen-check.last 2>/dev/null` | |
if [ "$LASTCNT" == "" ]; then | |
LASTCNT=0 | |
fi | |
if [ $RETCNT -gt $LASTCNT ]; then | |
echo "sound the alarm, we have transactions" | |
echo "`date` ${RET}" | sendemail -q -f from@gmail.com -t to@gmail.com -u "BITCOIN TRANSACTIONS!" -s smtp.gmail.com:587 -o tls=auto -xu from@gmail.com -xp password-of-from-gmail | |
echo ${RETCNT} >~/gen-check.last | |
sync | |
exit 0 | |
fi | |
echo "its ok" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment