Convert Command line to a service in ubuntu 16.04 LTS

541 views Asked by At

When I am running a command bitcore-node start it starts two services. Screenshot of ps aux is attached.

>

I created a service in /etc/init.d

description "Bitcoin Core for Bitcore"
author "BitPay, Inc."

limit nofile 20000 30000

start on runlevel [2345]
stop on runlevel [016]

kill timeout 300
kill signal SIGINT

# user/group for bitcore daemon to run as
setuid ubuntu
setgid ubuntu

# home dir of the bitcore daemon user
env HOME=/home/ubuntu

respawn
respawn limit 5 15

script
  exec bitcore-node -conf=/home/ubuntu/love/data/bitcoin.conf -datadir=/home/ubuntu/love/data -testnet
end script

I am getting error to while running it.

[1]: https://i.stack.imgur.com/eD5qT.png

Any Idea ?

1

There are 1 answers

0
Mark Stosberg On

You have written a script as an Upstart Init Script, and executed it as a SysV init using the systemd init systemd.

You could try placing the script in /etc/init/ instead of /etc/init.d. That way, it might be processed as the Upstart init script that it actually is.

However, Upstart is being replaced with systemd, so following a tutorial on translating your Upstart init script into a systemd .service file is recommended.