Created
October 25, 2020 21:21
-
-
Save pljones/365c733bb284348cfa74c708497d358f to your computer and use it in GitHub Desktop.
Jamulus service template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Jamulus Server %i | |
Documentation=http://jamulus.drealm.info/jamulus | |
Documentation=https://github.com/corrados/jamulus/wiki/Server-Troubleshooting | |
After=network-online.target | |
Wants=network-online.target | |
[Install] | |
WantedBy=multi-user.target | |
[Service] | |
CPUSchedulingPolicy=fifo | |
CPUSchedulingPriority=20 | |
IOSchedulingClass=realtime | |
IOSchedulingPriority=3 | |
SyslogIdentifier=Jamulus-%i | |
StandardOutput=syslog | |
StandardError=syslog | |
User=Jamulus | |
Group=Jamulus | |
WorkingDirectory=~ | |
Environment=UNIT=%i | |
EnvironmentFile=/opt/Jamulus/systemd/Jamulus.env | |
EnvironmentFile=/opt/Jamulus/systemd/%i.env | |
ExecStart=/opt/Jamulus/bin/run-Jamulus-template.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that I use symlinks a lot. So the above is
and this Jamulus service template - service-specific override,
[email protected]/Jamulus-server.conf
is actually(And, in fact, even the files in /opt/Jamulus are mostly symlinks elsewhere to give me files in one place under git control - but not on github.)
You only need the above if you've got something that needs to change per instance, other than what's configured in the environment files -- i.e. specifically to do with systemd itself.
So those environment files:
is this:
One of the
files --
%i
is the instance name (so when yousystemctl start Jamulus@instance
,%i
would beinstance
) might look like:And the final bit of "magic" is the run script, which simply maps the env variables to the command line:
The main point to note is
DAEMON="$JAMULUS_BINDIR/${JAMULUS}-${UNIT}"
, where thatEnvironment=UNIT=%i
comes in handy. It specifies the binary to execute based on the instance name. I have "stable", "current" and "work in progress" versions of Jamulus server, symlinked from theDAEMON
name.