More > JRiver Media Center 24 for Linux

Systemd Services for JRiver (To Facilitate Running Headless on Linux)

(1/2) > >>

mwillems:
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:

--- Code: ---  [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

--- End code ---

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:

--- Code: ---  [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

--- End code ---

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:


--- Code: ---[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

--- End code ---

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:


--- Code: ---x11vnc -storepasswd your_password ~/.vnc/passwd

--- End code ---

Once you've got the services in place you can set them to start on boot by typing

--- Code: ---sudo systemctl enable jriver.service

--- End code ---
and/or

--- Code: ---sudo systemctl enable x11vnc.service

--- End code ---

BradC:
Hi

With this script to start jriver in headless mode, how do I make JRiver play a playlist from boot?

I tried adding another line with mediacenter24 /Play TREEPATH="PLaylist name"

but it opened another instance of JRiver

help is appreciated

Brad

JimH:
Take a look at the options.  General > Behavior.  You may find what you need there.

mwillems:

--- Quote from: BradC on May 14, 2018, 07:12:53 pm ---Hi

With this script to start jriver in headless mode, how do I make JRiver play a playlist from boot?

I tried adding another line with mediacenter24 /Play TREEPATH="PLaylist name"

but it opened another instance of JRiver

help is appreciated

Brad

--- End quote ---

AFAIK the command line control switches aren't implemented on mediacenter for linux.  To make mediacenter play something you either have to point it at the literal file on the command line (which you could try if the playlist is a static playlist saved as a file), or send the request through MCWS and media network.  I've never done any direct automation that way so can't provide examples, but you can probably use curl or wget to send the MCWS command. 

BradC:

--- Quote from: JimH on May 14, 2018, 07:19:09 pm ---Take a look at the options.  General > Behavior.  You may find what you need there.

--- End quote ---

Hi

The only that I see is 'resume playback using bookmarks: Automatic'

This does seem to start the playlist on reboot where it left off

Any way to shuffle the playlist on each boot?

Navigation

[0] Message Index

[#] Next page

Go to full version