Daemon on CentOS 6.x?

Hello,

I managed to install testnet full node in user directory on CentOS 6.x linux server.
It hasn’t Upstart or systemd and utilizes old SystemV style scripts.
Is there an example to create such script to start bitcored as daemon using some custom full node directory?

Thanks in advance,
Igor

Not that I am aware. However, there are upstart and systemd scripts at: https://github.com/bitpay/bitcore/tree/master/scripts/debian

Dear Brandon,
we almost wrote the startup script. The only problem is to setup startup directory for bitcored.
As I found I can give to bitcored config script path like
bitcored -c [path]
But if I make this and try to run it from another directory it gives me error like:
Error: Cannot find module 'admin/package.json’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at loadModule (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:144:26)
at Function.setupServices (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:182:7)
at start (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:86:31)
at Object.main [as daemon] (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/cli/daemon.js:38:3)
at Liftoff. (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/cli/bitcored.js:32:16)
at Liftoff. (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/node_modules/liftoff/index.js:197:12)

There is -d key also ( -d, --daemon Make bitcore a daemon (running in the background)) but seems it does not works. bitcored works in the same manner as without it.

The --daemon option needs to be removed from the help text as it no longer included, since upstart/systemd and etc. manage log rotation and process management.

In regards to the error in startup, what services are enabled in your bitcore-node.json?

{
“network”: “testnet”,
“port”: 3001,
“services”: [
“admin”,
“bitcoind”,
“bitcore-wallet-service”,
“insight-api”,
“user”,
“web”
],
“servicesConfig”: {
“bitcoind”: {
“spawn”: {
“datadir”: “/Users/iev/Documents/bitcore-wallet-service/node_modules/mynode/data”,
“exec”: “/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/bin/bitcoind”
}
}
}
}

Admin and User are custom services.
I just deleted them but error there still:

bash-3.2$ bitcored -c ./mynode
module.js:327
throw err;
^

Error: Cannot find module 'bitcore-wallet-service/package.json’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at loadModule (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:144:26)
at Function.setupServices (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:182:7)
at start (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/scaffold/start.js:86:31)
at Object.main [as daemon] (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/cli/daemon.js:38:3)
at Liftoff. (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/lib/cli/bitcored.js:32:16)
at Liftoff. (/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/node_modules/liftoff/index.js:197:12)

I would try running with only these services:


"services": [
  "bitcoind",
  "web"
]

And then add the other services in, making sure that they are able to be loaded, and are in the node_modules.