Skip to content

Instantly share code, notes, and snippets.

@dnegi-dev
Last active March 6, 2022 18:34
Show Gist options
  • Select an option

  • Save dnegi-dev/ec75cd73e8b5225beec2589023965bc3 to your computer and use it in GitHub Desktop.

Select an option

Save dnegi-dev/ec75cd73e8b5225beec2589023965bc3 to your computer and use it in GitHub Desktop.

Uxplay firewalld and systemd service

First create a firewalld service file

If you want to use Vi as an editor, type in your terminal:

$ sudo vi /etc/firewalld/services/uxplay.xml

Or if you want to use nano type:

$ sudo nano /etc/firewalld/services/uxplay.xml

Paste the following xml into the editor (ctrl + shift + v / cmd + shift + v)

<?xml version="1.0" encoding="utf-8"?>
<service>
	<short>Uxplay Airplay Reciver</short>
	  <description>Ports used to allow video and audio connection to this host. UXplay has to be started with the option -p tcp 5000,5001,5002 -p udp 6001,6002,6003
          </description>
      <port protocol="tcp" port="5000"/>
      <port protocol="tcp" port="5001"/>
      <port protocol="tcp" port="5002"/>
      <port protocol="udp" port="6001"/>
      <port protocol="udp" port="6002"/>
      <port protocol="udp" port="6003"/>
</service>

Reload firewalld and locate the new service

$ sudo firewall-cmd --reload
$ firewall-cmd --get-services | grep 'uxplay'

Enable firewalld service

$ sudo firewall-cmd --zone=public --permanent --add-service=uxplay

Create sytemd service file

$ vi ~/.local/share/systemd/user/uxplay.service
# if the folder is not found create it with 'mkdir -p ~/.local/share/systemd/user'

Now paste the following and substitute with the name you want the receiver to appear.

[Unit]
Description=Uxplay service

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/local/bin/uxplay -n <RECIVER NAME> -m -fps 60 -nh -p tcp 5000,5001,5002 -p udp 6001,6002,6003

[Install]
WantedBy=default.target

Activate the serivce with the following command

$ systemctl --user enable --now uxplay.service
# Let the user run systemd services without being logged in
$ sudo loginctl enable-linger $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment