systemd and its associated command
systemctl are fundamental elements of most modern Linux distributions. They offer a host of advantages when it comes to managing and controlling system services, including various applications. In this guide, we’ll walk you through the process of setting up a service for the
oak-collator program. This setup ensures that the
oak-collator automatically restarts after system reboot or unexpected program shutdown, enhancing its reliability and ease of use.
To prepare for setting up a
systemd service for the OAK binary, you’ll need the
INSTALLATION_DIR: Directory where downloaded the
NODE_NAME: Custom identifier for your node
DATA_DIR: Directory where you would like to store OAK blockchain data
NODE_KEY: Key for running your collator
USER: User that the service should run as
GROUP: Group that the service should run as
Once you have prepared the required information, you can use the following
service definition to run the OAK collator. On Debian based distributions, this
file should be placed at
After you have created the service definition, you can enable and start the
systemctl enable oak-collator
systemctl start oak-collator
systemd will automatically start your collator when you restart your system or if the process is killed. Here are some other commands that might be useful while operating an OAK node.
systemctl status oak-collator --no-pager --full
Get the running status of the program. The
--no-pageroption will avoid text cutoff from long lines.
journalctl -u oak-collator -f
View logs of the program. The
-fwill follow and stream the latest lines. For more display options please refer to the instructions in
systemctl restart oak-collator
Restart the collator service
Monitoring & Alerting
Since OAK is a Substrate-based project, you can use Node Exporter, Prometheus and Grafana to monitor your nodes. For more information, please follow this Substrate tutorial.