Here's a systemd service that will automatically start jriver on boot as your user (after the display manager loads), and if JRiver should crash, restarts it within 10 seconds. This will work best on systems with autologin, but because of the restarting feature, should work fine even if it has to wait for you to login. You want to put your username in the "user" spot, and put the following text in a file at /etc/systemd/system/jriver.service:
[Unit]
Description=JRiver
After=display-manager.service
[Service]
Type=simple
Environment=DISPLAY=:0
User=your_user_here
ExecStart=/usr/bin/mediacenter24 /MediaServer
Restart=always
RestartSec=10
KillSignal=SIGHUP
TimeoutStopSec=45
[Install]
WantedBy=graphical.target
If you have already setup the optional thread prioritization to prioritize CPU time for audio playback (as described here:
https://yabb.jriver.com/interact/index.php/topic,115349.msg797319.html#msg797319), use the following service file instead:
[Unit]
Description=JRiver
After=display-manager.service
[Service]
Type=simple
Environment=DISPLAY=:0
User=your_user_here
ExecStart=/usr/bin/mediacenter24 /MediaServer
Restart=always
RestartSec=10
KillSignal=SIGHUP
TimeoutStopSec=45
LimitRTPRIO=100
[Install]
WantedBy=graphical.target
Some technical notes: this presumes you're running on your actual display, not a virtual display generated by a VNC client. If you are using such a virtual display, substitute the display variable in the Environment section, and change the "After" line to refer to the name of the systemd service you're using to start your vnc server, but note that VNC virtual displays may not work correctly anymore with MC since 22.0.36.
In that vein, here's a service to start x11vnc to allow remote access to your actual display on boot. It similarly will restart if it crashes. You want to put your username in place of
both of the "your_user_here" placeholders below, create a file at /etc/systemd/system/x11vnc.service, and put the following text there:
[Unit]
Description=x11vnc
After=display-manager.service
[Service]
Type=forking
Environment=DISPLAY=:0
User=your_user_here
ExecStart=/usr/bin/x11vnc -rfbauth /home/your_user_here/.vnc/passwd -display :0 -geometry 1920x1080 -auth guess -forever -bg
Restart=always
RestartSec=10
[Install]
WantedBy=graphical.target
Technical notes: this presumes that you've already setup a VNC password. If you want to run without a password remove the -rfbauth flag and the path following it. If you want to set a password run the following command replacing "your_password" with your password:
x11vnc -storepasswd your_password ~/.vnc/passwd
Once you've got the services in place you can set them to start on boot by typing
sudo systemctl enable jriver.service
and/or
sudo systemctl enable x11vnc.service