Part 8 - Configure Services

Part 8 - Configure Services

  • Create systemd service units for zend and tracker

  • Stop zend

  • Start zend and zentracker services

  • Get status of zend and zentracker services

  • Enable units at boot

 

Description

Command

Description

Command

1

Create a systemd unit file for zend, copy and paste the entire block of text

echo \ "[Unit] Description=Zen daemon [Service] User=$USER Type=forking ExecStart=/usr/bin/zend -daemon -pid=$HOME/.zen/zend.pid PIDFile=$HOME/.zen/zend.pid Restart=always RestartSec=10 [Install] WantedBy=multi-user.target" | sudo tee /lib/systemd/system/zend.service
2

Create a systemd unit file for the Node Tracker, copy and paste the entire block of text

echo \ "[Unit] Description=Zen node daemon installed on ~/nodetracker/ [Service] User=$USER Type=simple WorkingDirectory=$HOME/nodetracker/ ExecStart=$(which node) $HOME/nodetracker/app.js Restart=always RestartSec=10 [Install] WantedBy=multi-user.target" | sudo tee /lib/systemd/system/zentracker.service
3

Stop zend and apply ownership to the non-root user of all files created since part 6.8

 

zen-cli stop && sleep 30 && sudo chown -R $USER:$USER ~/
4

Test the unit files

sudo systemctl start zend zentracker
5

Check the status of both zend and the tracker, both should return active (running). If the status doesn't send you back to a command prompt, exit the status details by pressing CTRL + c

 

sudo systemctl status -n 0 zend zentracker

 

6

Follow the logs from the tracker to check for the first challenge being received, exit by pressing CTRL + c

 

sudo journalctl -fu zentracker
7

If both systemd unit files work correctly (showing active and running in step 6) enable them at boot

sudo systemctl enable zend zentracker

Part 9 of 11 - Configure Services