user84262: I want to know when a new block is discovered, I am watching debug.log to see if it has changed, I know there is a new block if the line contains "UpdateTip: new best". Is there a better way to do this?

user83952: You can use blocknotify option, Execute command when the best block changes, read more here https://en.bitcoin.it/wiki/Running_Bitcoin 

user7272: bitcoind offers a zmq hook which you can use to receive notifications on new blocks and transactions.

84262: <p>I want to know when a new block is discovered, I am watching debug.log to see if it has changed, I know there is a new block if the line contains "UpdateTip: new best". Is there a better way to do this?</p>
 83952: <p>You can use blocknotify option, Execute command when the best block changes, read more here <a href="https://en.bitcoin.it/wiki/Running_Bitcoin" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Running_Bitcoin</a> </p>
 7272: <p><code>bitcoind</code> offers a <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md" rel="nofollow noreferrer">zmq hook</a> which you can use to receive notifications on new blocks and transactions.</p>
