Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: aferret on July 11, 2014, 07:52:35 PM



Title: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: aferret on July 11, 2014, 07:52:35 PM
Hey all,

I'm not very much involved with Bitcoin anymore, but I do still do minor amounts of mining, and occasionally do micropayments.  Ergo, I'd like to maybe once a week, once a month spin up my client just to synchronize blocks (so if I *do* need to use it, it's current), and shut down.

I'm on mac, for what it's worth.

The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.  What I'm really looking for is something more like "run until synchronized, OR for a maximum of N hours".

Is there a better way that I'm missing?  Is this/should this be a feature request?


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: azeteki on July 11, 2014, 08:08:31 PM
You said you didn't want to mess with the API, but in case you do, it should not be that difficult to make up a script that can achieve this.

Start up bitcoin-qt.

Using JSON-RPC, poll it for latest block every now and then ('getbestblockhash', 'getblock').
Assume you are synced when the 'time' field is within say 12 hours of your system time.
Using JSON-RPC, send 'stop' request.

A cron job with a bash script (does mac have equivalents?) seems capable of doing it.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: dserrano5 on July 11, 2014, 08:45:39 PM
The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.

If you're going to run bitcoin at 3am, why not do it daily? You can let it run for 2-3 hours, then issue a 'bitcoin-cli stop' and you'll always have the chain pretty much updated.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: InwardContour on July 12, 2014, 07:37:25 PM
Every Sunday you can simply open QT via the spotlight, let it run while you do your thing on your computer, checking every two hours or so and when you see the green check that shows it is fully synced you can press "apple" + "Q" to close it.

It could not be more simple then this


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: Relnarien on July 13, 2014, 04:23:59 AM
Hey all,

I'm not very much involved with Bitcoin anymore, but I do still do minor amounts of mining, and occasionally do micropayments.  Ergo, I'd like to maybe once a week, once a month spin up my client just to synchronize blocks (so if I *do* need to use it, it's current), and shut down.

I'm on mac, for what it's worth.

The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.  What I'm really looking for is something more like "run until synchronized, OR for a maximum of N hours".

Is there a better way that I'm missing?  Is this/should this be a feature request?

I'm a little confused about what you actually want to do. You can just set automated tasks on your Mac to launch the client and shutdown your computer if that's all you really need. Isn't Automator available for the version of Mac OS that you're using?


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: cp1 on July 13, 2014, 04:27:41 AM
The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.

If you're going to run bitcoin at 3am, why not do it daily? You can let it run for 2-3 hours, then issue a 'bitcoin-cli stop' and you'll always have the chain pretty much updated.

Yeah, just do whatever cron is called on mac with two jobs, one to start and one to stop.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: AliceWonder on July 13, 2014, 09:56:59 PM
The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.

If you're going to run bitcoin at 3am, why not do it daily? You can let it run for 2-3 hours, then issue a 'bitcoin-cli stop' and you'll always have the chain pretty much updated.

Yeah, just do whatever cron is called on mac with two jobs, one to start and one to stop.

They call it something else but the user crontab command is still there and it still reads a standard crontab file.

At least on whatever version of OS X my mum has.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: InwardContour on July 14, 2014, 01:58:20 AM
The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.

If you're going to run bitcoin at 3am, why not do it daily? You can let it run for 2-3 hours, then issue a 'bitcoin-cli stop' and you'll always have the chain pretty much updated.

Yeah, just do whatever cron is called on mac with two jobs, one to start and one to stop.
Even this is much more complicated then it needs to be. The OP can simply open bitcoin QT and close it once it has synched the blockchain. This would take no more then a total of 30 seconds of the OP's time every week.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: nwfella on July 14, 2014, 07:55:57 AM
Use Cocktail to schedule regular startup's with shutdown's issued after whatever time period is reasonable given how often you update your wallet and the speed with which your system/connection does it.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: kokojie on July 14, 2014, 04:22:14 PM
Same as on any OS, use the task scheduler for your OS, to start bitcoin-qt, wait 2-3 hours, then shut it down.



Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: Sydboy on July 14, 2014, 07:22:12 PM
lol yeah. OP will spend 6 weeks researching and testing this when it could easily be done with a few clicks.

The --help seems to imply there's no way to quit automatically, and without messing with the JSON API and whatnot, I suppose the easiest way is to start up at 3am, run for a few hours, then send a kill to the PID file, but that feels dirty.

If you're going to run bitcoin at 3am, why not do it daily? You can let it run for 2-3 hours, then issue a 'bitcoin-cli stop' and you'll always have the chain pretty much updated.

Yeah, just do whatever cron is called on mac with two jobs, one to start and one to stop.
Even this is much more complicated then it needs to be. The OP can simply open bitcoin QT and close it once it has synched the blockchain. This would take no more then a total of 30 seconds of the OP's time every week.


Title: Re: Way to fire up Bitcoin-QT once a week to sync blocks, then quit?
Post by: AliceWonder on July 14, 2014, 09:18:28 PM
lol yeah. OP will spend 6 weeks researching and testing this when it could easily be done with a few clicks.

Automating things means you don't have to remember, and means you can schedule it to take place when you normally aren't doing other things. And automating probably means he can do with bitcoind instead of bitcoin-qt