简体   繁体   English

在Ubuntu 16.04中后台将bitcore-node作为服务运行

[英]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. 我已经成功安装了bitcore,并且能够与bitcore-node start一起运行。 But I want to run it as service in the background. 但是我想在后台将其作为服务运行。

Installation Step of Bitcore-node. Bitcore节点的安装步骤。

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 在运行bitcore-node start正常运行

I created a service in the /etc/systemd/system 我在/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. 在执行命令sudo service bitcore status时,出现以下错误。

在此处输入图片说明

Any help would be appreciated. 任何帮助,将不胜感激。

I used pm2 我用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 更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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