Running P2Pool as a [systemd] service in Ubuntu 16.04

Given that vertcoind and p2pool-vtc are unpacked in your home directory, and configured to work together, we'll set them up as systemd services so that they all start at boot up.

DISCLAIMER: Vertcoind daemon (https://github.com/vertcoin/vertcoin/releases) and p2pool-vtc (https://github.com/vertcoin/p2pool-vtc) are used as example in this post, but the principles should apply to any bitcoind like daemon and P2Pool fork.

Consider 'bob' is the linux user that contains the binaries and the credential as which things will run.

Create /etc/systemd/system/vertcoind@bob.service with this contents:

[Unit]
Description=vertcoind
After=network.target

[Service]
Type=simple
User=%i
ExecStart=/home/bob/vertcoin/vertcoind -upnp

[Install]
WantedBy=multi-user.target

Create /etc/systemd/system/p2pool1@bob.service with:

[Unit]
Description=p2pool1
After=vertcoind.service

[Service]
Type=simple
User=%i
ExecStart=/home/bob/p2pool-vtc/run_p2pool.py --net vertcoin user s0m3passW0rd

[Install]
WantedBy=multi-user.target

Replace user s0m3passW0rd with the RPC credentials vertcoind is configured with.

We'll set up a third service to launch another P2Pool node in the second Vertcoin network (for small miners generating under 100MH/s). Create /etc/systemd/system/p2pool2@bob.service with:

[Unit]
Description=p2pool2
After=vertcoind.service

[Service]
Type=simple
User=%i
ExecStart=/home/bob/p2pool-vtc/run_p2pool.py --net vertcoin2 user s0m3passW0rd

[Install]
WantedBy=multi-user.target

Reload systemd list of unit files:

sudo systemctl --system daemon-reload

Enable the services for auto-start:

sudo systemctl enable vertcoind@bob
sudo systemctl enable p2pool1@bob
sudo systemctl enable p2pool2@bob

Start the services:

sudo systemctl start vertcoind@bob
sudo systemctl start p2pool1@bob
sudo systemctl start p2pool2@bob

To view the output of a given service one can use:

sudo journalctl -f -u p2pool1@bob

To stop a service:

sudo systemctl stop p2pool1@bob

or

sudo service p2pool1@bob stop

Reboot the machine to verify that the services are up and running after restart.

Reference: https://home-assistant.io/docs/autostart/systemd/

Vertcoin donations: VmRWxjjLt4u8FiZ8gDeZAvLKepk2pQ2rt6