Run Anemos with systemd on Linux
Run Anemos with systemd on Linux
Preface
Systemd is a system and service manager for Linux that helps manage how programs start up, run, and shut down. It also handles system processes, logging, and basic service monitoring.
Prerequisites
Before setting up Anemos to run with systemd, ensure you have the following:
- Download the latest version of Anemos CLI for your Linux system from here.
- This guide assumes that
systemdis installed and running on your Linux distribution. Most modern distributions usesystemdby default.
Creating a systemd Service
To create a systemd service for Anemos, follow these steps:
- Initialize the Anemos Node: Before running the service, initialize the Anemos node with this command:
anemos-daemon init- Create a Service File: Open a terminal and
create a new service file in the
/etc/systemd/system/directory with superuser permissions:
sudo nano /etc/systemd/system/anemos.service- Add the Following Content to the service file, replacing
<USER_NAME>with your actual username:
[Unit]
Description=Anemos Daemon Service
After=network.target
[Service]
Type=simple
User=<USER_NAME>
ExecStart=/home/<USER_NAME>/anemos-cli/anemos-daemon start -w /home/<USER_NAME>/anemos
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target- Reload Systemd Configuration: After creating or modifying the service file, reload the systemd to recognize the new service:
sudo systemctl daemon-reload- Start and Enable the Service: Start the service immediately and enable it to start on boot:
sudo systemctl start anemos
sudo systemctl enable anemos- Check Service Status: Check the status of your service to ensure it is running correctly:
sudo systemctl status anemosManaging the Service
Use these commands to manage the Anemos service with systemd:
Start the Service:
sudo systemctl start anemosStop the Service:
sudo systemctl stop anemosRestart the Service:
sudo systemctl restart anemosEnable the Service to Start on Boot:
sudo systemctl enable anemosDisable the Service from Starting on Boot:
sudo systemctl disable anemos
Checking Logs
If the service fails to start or behaves unexpectedly, check the logs using journalctl:
sudo journalctl -u anemos.serviceThis command will show you the log entries related to your service, helping you diagnose issues.
Last updated on