简体   繁体   中英

Run bitcore-node as a service in the background in Ubuntu 16.04

I successfully installed bitcore and able to run with the bitcore-node start. But I want to run it as service in the background.

Installation Step of Bitcore-node.

curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install nodejs
sudo apt-get install python
sudo apt-get install libzmq3-dev build-essential
npm install -g bitcore-node (https://github.com/bitpay/bitcore-node)

On Running bitcore-node start its working perfectly

I created a service in the /etc/systemd/system

[Unit]
Description=bitcored.service
After=network.target

[Service]
Type=simple
User=ubuntu
Environment="PATH=$PATH:/home/ubuntu/usr/bin"
ExecStart=/root/bin/node /usr/lib/node_modules/bitcore-node/bin/bitcore-node
ExecReload=/bin/kill -2 $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

On Executing the command sudo service bitcore status , I am getting following Error.

在此处输入图片说明

Any help would be appreciated.

I used pm2

# install pm2
npm install pm2 -g

# go into your project and start it with pm2
cd mynode
pm2 start bitcore -- start

# check the logs that all runs smoothly
pm2 logs

# if everything runs fine 
# can setup the script to run on boot/reboot
pm2 startup
pm2 save 

More info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM