aceat64/EasyBitcoin-PHP

How to make calls when script is run as daemon?

in3rsha opened this issue · 1 comments

I realize this isn't an issue, but I thought I might be able to get the best advice here.

I've written a script that makes RPC calls using EasyBitcoin-PHP. When I run this script directly everything works fine.

However, I'd like to run this script as a daemon using systemd. When I start the daemon using systemctl start myscript, I see the following error:

error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/.bitc...

I think this may be because the script is being executed as root, and so it can't find the location of ~/bitcoin/bitcoin.conf correctly.

What would be the best way to get around this?

That's not an error you'd get from this library, it's an error generated by the bitcoin-cli program. Your script is likely calling bitcoin-cli with either system(), exec() or similar.