Skip to content

Instantly share code, notes, and snippets.

@bjpetit
Created November 22, 2023 17:28
Show Gist options
  • Save bjpetit/0cee2ca37ac97695692c62b2c81fbba2 to your computer and use it in GitHub Desktop.
Save bjpetit/0cee2ca37ac97695692c62b2c81fbba2 to your computer and use it in GitHub Desktop.
Systemd file for direwolf
[Unit]
Description=Direwolf %i Service
Documentation=https://github.com/wb2osz/direwolf/blob/dev/doc/README.md
After=network-online.target
Requires=rigctld.service
After=rigctld.service
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/opt/direwolf/
ExecStart=/usr/local/bin/direwolf -a 200 -qd -c config/direwolf-%i.conf
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
@bjpetit
Copy link
Author

bjpetit commented Nov 22, 2023

This systemd file can be used to automatically start/restart direwolf. The base assumptions in this file are

  1. The direwolf binary is installed in the standard location. See ExecStart line.
  2. There is an /opt/direwolf directory which contains a config directory.
  3. This systemd service can support multiple direwolf instances.
    a. The syntax for starting services is 'systemctl start direwolf@argument', where argument is a unique name for this instance of the direwolf service.
    - This systemd service file must be named 'direwolf@.service' to support named instances.
    b. The argument is then used in the systemd file where the %i variables are seen.
    c. For example, if a direwolf service is started using the command 'systemctl start direwolf@vhf', the systemd service will start direwolf using a config file named direwolf-vhf.conf (located in /opt/direwolf/config).

This service will automatically restart direwolf if it stops. It currently requires and waits for a rigctld service to start so that PTT works. If you do not use rigctld, then you can remove the two lines referring to rigctld.service.

This service currently runs direwolf as the user/group pi, rather than root. If you would like to run as another user, change the User and Group lines to the desired account names.

This will also send all direwolf output to the journald service. To look at direwolf logs, run the 'journalctl -u direwolf@argument' command. Journalctl has numerous options for specifying time ranges and can follow updates to the file (like tail -f) using the -f argument. Journalctl will automatically manage log files, cleaning them up based on the systems logging settings.

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