Run service with systemctl
This is a short guide to run bitcore-node as a service. This guide will get updated once we have the service running with PM2.
- 1.Copy your service file into the /etc/systemd/system folder.
Digital Ocean
AWS
[Unit]
Description=Bitcore-node
After=network.target
[Service]
ExecStart=/home/ubuntu/btcp-explorer/start-service.sh
WorkingDirectory=/home/ubuntu/btcp-explorer/
[Install]
WantedBy=multi-user.target
#/root/btcp-explorer/node_modules/bitcore-node-btcp/bin/bitcore-node start
[Unit]
Description=Bitcore-node
After=network.target
[Service]
ExecStart=/home/ubuntu/btcp-explorer/start-service.sh
WorkingDirectory=/home/ubuntu/btcp-explorer/
[Install]
WantedBy=multi-user.target
#/home/ubuntu/btcp-explorer/node_modules/bitcore-node-btcp/bin/bitcore-node start
- 1.a Create a new start-service.sh in the /home/ubuntu/btcp-explorer/ folder
Digital Ocean
AWS
#!/bin/bash
sudo /usr/local/bin/node /root/btcp-explorer/node_modules/bitcore-node-btcp/bin/bitcore-node start
#!/bin/bash
sudo /usr/local/bin/node /home/ubuntu/btcp-explorer/node_modules/bitcore-node-btcp/bin/bitcore-node start
- 1.b Give start-service.sh executable permissions.chmod +x start-service.sh
- 2.Create system link for the .zcash-params & btcp-exploer folder the ubuntu directory to the /root directory as the script is currently outdated and looks for them in the incorrect directory
Digital Ocean
AWS
sudo ln -s /root/.zcash-params/ /root/.zcash-params/
sudo ln -s /root/btcp-explorer /root/btcp-explorer
sudo ln -s /home/ubuntu/.zcash-params/ /root/.zcash-params/
sudo ln -s /home/ubuntu/btcp-explorer /root/btcp-explorer
Done. You can now use the following commands:
Start the service
sudo systemctl start bitcore-node
Stop Service
sudo systemctl stop bitcore-node
See the console log
journalctl -u bitcore-node
Last modified 5yr ago