Skip to content

Instantly share code, notes, and snippets.

@bjpetit
Last active August 5, 2024 15:09
Show Gist options
  • Save bjpetit/983d9fc139289752985ac2d97633f3b3 to your computer and use it in GitHub Desktop.
Save bjpetit/983d9fc139289752985ac2d97633f3b3 to your computer and use it in GitHub Desktop.
Simple systemd file for direwolf
[Unit]
Description=Direwolf Sound Card-based AX.25 TNC
After=network.target
After=sound.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/opt/direwolf/
# -t 1 will preserve color. Use -all option in journalctl
ExecStart=/usr/local/bin/direwolf -t 1 -a 600 -c direwolf.conf
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
@bjpetit
Copy link
Author

bjpetit commented Nov 22, 2023

This systemd service file can automatically start/restart direwolf. It makes a couple assumptions.

  1. The direwolf configuration file lives in /opt/direwolf. If you need to place your direwolf.conf file in another directory, update the WorkingDirectory line with the desired directory path.
  2. The direwolf program will run as the user/group pi. If you want another user to run the program update the User and/or Group lines to reflect the account that will run the program.
    • Note: Is is always recommended to run services with the least privileges necessary. Thus it is not recommended to run this direwolf service as root.

To add this service to your system, copy it into /lib/systemd/system/
After adding this service file, or updating this service file, the service info must be reloaded.
To do this, run sudo systemctl daemon-reload

To manage this service use the following commands.

To start the direwolf service run sudo systemctl start direwolf
To stop the direwolf service run sudo systemctl stop direwolf
To configure the direwolf service to start automatically on boot run sudo systemctl enable direwolf
To configure the direwolf service to NOT start automatically on boot run sudo systemctl disable direwolf
To look at the current status of the direwolf service, run sudo systemctl status direwolf

To see the direwolf logs, use the journalctl -u direwolf command. See the journalctl man page for additional options.
For example, the -f flag can be used to 'follow' the log for continuous updates. To watch direwolf logs in real-time, run the following command.
journalctl -u direwolf -f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment