FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

Start UxPlay as a service? #80

Closed C0rupted closed 2 years ago

C0rupted commented 2 years ago

I am making a TV box using an RPi 4 that I have got.

I've managed to figure out the right parameters to get UxPlay working, but I have been trying to figure out how to run UxPlay as a service, so it runs at start up with the arguments I give it.

Also, I have made it so Kodi starts up at boot, as soon as the desktop and required dependencies load. I was thinking, would there be a way to modify UxPlay to make it so that it stops Kodi before establishing the connection? To start Kodi, I have used the autostart menu in XFCE.

BTW, I am running TwisterOS. (Based off Raspbian Buster 32-bit) Any help is appreciated.

qrkourier commented 2 years ago

You can manage processes on Debian Buster with systemd. You need a service unit definition file that describes the process and its environment in the right directory, then you can do systemctl daemon-reload to load that configuration. Then you can use the standard systemctl commands to control the process, and journalctl to view the log emissions to the journal.

fduncanh commented 2 years ago

seems that there is nothing more to say?

monomycelium commented 2 years ago

@ShadityZ, can I take a look at your service file? I'm wondering how you set the environment.

MynockSpit commented 4 months ago

Big 'ol necro here, but on the off chance that people still want this, this is what my service looks like:

[Unit]
Description=Airplay Server/Reciever for Mac/Windows/PC
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Environment="DISPLAY=:0"
ExecStart=uxplay -n Raspi -nh"" -fs
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=default.target

A couple of notes:

EDIT: Added environment variable. 🤦🏽