Title: Bash script sends BTC to central wallet Post by: racerx on October 11, 2010, 02:58:43 PM I just got bitcoin up and running on about 50 cores (not servers) across our hosted env and office. All the logging in and checking balances was getting tedious so I wrote a quick and dirty bash script that sits in /etc/cron.daily and sends payments to my central wallet.. I know I could have used json but sometimes a simple bash script is just the way to go :)
It assumes that bitcoind is in the PATH. Code: #!/bin/bash Hope someone finds it handy... and feel free to add to it. Title: Re: Bash script sends BTC to central wallet Post by: racerx on October 14, 2010, 03:15:26 PM Yeah, I saw that but I had issues trying to get it running as it wanted jsonpc stuff. I wanted to get it deployed over quite a few nodes and didnt want alot of manual bits and pieces to addon, perhaps I just missed something obvious :)
anyway heres a refined version: Code: 42 * * * * root if [ $(/usr/local/bin/bitcoind getbalance) = 0.00000000 ]; then echo "No Coins Generated"; else /usr/local/bin/bitcoind sendtoaddress 1AVgSRgQ4dF8Fwi3hfvFZ1uhnWoWGT25sR $(/usr/local/bin/bitcoind getbalance) $HOSTNAME $HOSTNAME; fi just make a file and put this in /etc/cron.d Only issue I had was the cron running as root but I was running bitcoind as a local user... root had no ~/.bitcoind/bitcoin.conf so it was bitching. Title: Re: Bash script sends BTC to central wallet Post by: grondilu on October 22, 2010, 11:42:12 PM Only issue I had was the cron running as root but I was running bitcoind as a local user... root had no ~/.bitcoind/bitcoin.conf so it was bitching. I love bash scripting, so please let me help to try to improve this script a bit. Code: #!/bin/bash Title: Re: Bash script sends BTC to central wallet Post by: racerx on October 28, 2010, 09:36:02 PM Brilliant! thanks, it really needed a bit of a cleanup.
|