Setting assignment-client and domain-server as a service in systemd (Ubuntu)


#1

Here is how I got both assignment-client and domain-server to work as a service in Ubuntu using this guide.

in /etc/systemd/system/assignment-client.service
(you need to replace the paths and user account with what you are using)

[Unit]
Description=start HIFI assignment client server

[Service]
User=yourHiFiUser
WorkingDirectory=/path/to/hifi/build
ExecStart=/path/to/hifi/build/assignment-client/assignment-client -n 6
Restart=always

[Install]
WantedBy=multi-user.target

in /etc/systemd/system/domain-server.service

[Unit]
Description=start HIFI domain server

[Service]
User=yourHiFiUser
WorkingDirectory=/home/yourHiFiUser
ExecStart=/path/to/hifi/build/domain-server/domain-server
Restart=always

[Install]
WantedBy=multi-user.target

Make sure the files are not executable or you will get syslog spam telling you it is executable:

sudo chmod -x assignment-client.service
sudo chmod -x domain-server.service

Then use these commands to get it started:

sudo systemctl start assignment-client.service
sudo systemctl stop assignment-client.service
sudo systemctl enable assignment-client.service

sudo systemctl start domain-server.service
sudo systemctl stop domain-server.service
sudo systemctl enable domain-server.service

To view logs you can watch /var/log/syslog or you can use:

sudo journalctl -u assignment-client.service
sudo journalctl -u domain-server.service

Now the hifi server will restart if it ever crashes or if you reboot.

Also be sure to remove any leftover files ending with ~ if you edited the file more than once (I use emacs, might be different with nano or vi).

sudo rm *~

I suggest making a new user account that only runs hifi servers. Never run as root! (But if you are able to compile and run a hifi server in Linux you probably already know that).


Quick and Dirty Domain Setup Guide ($20 a Year)(The Dirty Kurty)
#2

This is rad as heck!