follow us on twitter . like us on facebook . follow us on instagram . subscribe to our youtube channel . announcements on telegram channel . ask urgent question ONLY . Subscribe to our reddit . Altcoins Talks Shop Shop


This is an Ad. Advertised sites are not endorsement by our Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise Here

Author Topic: Automated Bitcoin Payments  (Read 589 times)

Offline taera249

  • Jr. Member
  • *
  • Activity: 70
  • points:
    3440
  • Karma: 2
  • Trade Count: (0)
  • Referrals: 0
  • Last Active: March 23, 2018, 05:40:40 PM
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Topic Starter 50 Posts 10 Posts
Automated Bitcoin Payments
« on: January 25, 2018, 11:45:46 AM »
Hi all,

I want to run a script once a week that sends an amount to a specific address. The amount sent is decided by how much was deposited into the account during the week. For instance the wallet must always have 1 BTC in it and anything over that is sent to the new address each week.

The OS i am using in ubuntu on a Raspberry Pi 3 and i know how to schedule the job using crontab but i do not know how to write the bash script. The bitcoin daemon and bitcoin-cli are all hosted on the same machine as the script.

so far this is what i have.

#!/bin/bash
if [ $(echo "$(bitcoin-cli getbalance) > 1" | bc) -eq 1 ];
then
      bitcoin-cli sendtoaddress ADDRESS $(bitcoin-cli getbalance - 1) "Automated Payment"
fi

Does anyone have any suggestions on how to improve this?

Thanks

Altcoins Talks - Cryptocurrency Forum

Automated Bitcoin Payments
« on: January 25, 2018, 11:45:46 AM »

This is an Ad. Advertised sites are not endorsement by our Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise Here Ads bidding Bidding Open


 

ETH & ERC20 Tokens Donations: 0x2143F7146F0AadC0F9d85ea98F23273Da0e002Ab
BNB & BEP20 Tokens Donations: 0xcbDAB774B5659cB905d4db5487F9e2057b96147F
BTC Donations: bc1qjf99wr3dz9jn9fr43q28x0r50zeyxewcq8swng
BTC Tips for Moderators: 1Pz1S3d4Aiq7QE4m3MmuoUPEvKaAYbZRoG
Powered by SMFPacks Social Login Mod