Run daemon as a service

PluraCoin edited this page Mar 9, 2018 · 2 revisions

You should run the service under your sudo user, for example user `pluracoin`

 su - pluracoin

Create the service via your favourite text editor

 sudo nano /etc/systemd/system/pluracoind.service

Add the following blocks to the file and adjust username and path to pluracoind daemon

 [Unit]
 Description=pluracoind
 After=syslog.target
 [Service]
 User=pluracoin
 Type=forking
 GuessMainPID=no
 ExecStart=/home/pluracoin/pluracoin/build/release/src/pluracoind --rpc-bind-ip=127.0.0.1
 Restart=always
 SuccessExitStatus=143
 TimeoutSec=infinity
 [Install]
 WantedBy=multi-user.target

Save the file and run

 sudo systemctl daemon-reload
 sudo systemctl enable pluracoind.service
 sudo systemctl start pluracoind.service

Now the pluracoind service seems to hang - that's because the system waits for success exit status but the service is not sending it event it is running fine. So don't worry, just press Ctrl + C to get back to shell. The service is running on the background now. Check it with `top` or `htop` command.

You can also check the pluracoind.service status with

 systemctl status pluracoind.service

Congrats! Your pluracoind daemon runs on the background.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.