Skip to main content
Topic: [Solved] Plex Media Server init (Read 1802 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

[Solved] Plex Media Server init

I've tried using the ones over at Gentoo, however, they apply a very specific patch which I cannot seem to use properly. Can anyone either tell me how to create a proper init, or how to create a pkgbuild specifically for openrc?

Re: Plex Media Server init

Reply #1
Okay, I actually managed to make it work. I did it by using the default script over at gentoo, but modified it to use /usr/lib/plexmediaserver/start.sh for the script. I then modified that script by removing the first two variables declared at the top, changing both the LD_LIBRARY_PATH and PLEX_MEDIA_SERVER_HOME to /usr/lib/plexmediaserver/ so it pointed to the right area, and changed the ./Plex\ Media\ Server to /usr/lib/plexmediaserver/Plex\ Media\ Server at the bottom, then chown'd the entire plexmediaserver directory and it's subdirectories so the plex user could write to it.

This is FAR from ideal, and I'm sure there's a better way, but I really can't get it to behave otherwise.

Re: Plex Media Server init

Reply #2
plex-media-server.init.d
Code: [Select]
#!/sbin/openrc-run

start() {
ebegin "Starting Plex Media Server"
start-stop-daemon -S -m -p ${PLEX_PIDFILE} -1 ${PLEX_OUTLOG} -2 ${PLEX_ERRLOG} --quiet -u ${PLEX_USER} -N -5 -b --exec ${PLEX_SCRIPT}
eend $?
}

stop() {
ebegin "Stopping Plex Media Server"
kill -- -`cat ${PLEX_PIDFILE}`

# Remove stale pid file since this is a dirty solution
rm ${PLEX_PIDFILE}
eend $?
}
plex-media-server.conf.d
Code: [Select]
# Config file for /etc/init.d/plex-media-server

PLEX_PIDFILE="/var/run/plex-media-server.pid"
PLEX_OUTLOG="/var/log/pms/out.log"
PLEX_ERRLOG="/var/log/pms/err.log"
PLEX_USER="plex"
PLEX_SCRIPT="/usr/sbin/start_pms"

Please read my previous posts. Firstly, start_pms doesn't exist without the gentoo specific patches as gentoo wraps it in a python sandbox, which is what the patch does. Secondly, since this sandbox is missing, there's a number of permissions errors that occur since it's not using systemd to do the work, so the init and conf you just posted, is literally the one I modified to get it working.

https://gitweb.gentoo.org/repo/gentoo.git/tree/media-tv/plex-media-server/plex-media-server-1.10.0.ebuild?id=722d558fc15dbbed71fff409cf8684e4b107f162
look at the ebuild, it should make more sense. I'm not terribly familiar with makepkg unfortunately, so I wouldn't know how to take their changes and make it into a package, but without their changes, that conf and init are useless without modification, and even my modifications only barely work.

 

Re: Plex Media Server init

Reply #3
ok, sorry,
unfortunately i have no time play with your plex.

Re: Plex Media Server init

Reply #4
ok, sorry,
unfortunately i have no time play with your plex.
Well, would you happen to know a good resource for learning makepkg's? I've been looking into it and apparently ebuilds and makepkgs aren't terribly dissimilar, but I find the structure of makepkgs confusing as the documentations isn't the most straightforward thing I've ever seen, and my braindead ass has a real tough time with obscurity.


Re: Plex Media Server init

Reply #6
You can make a package and ask the Artix devs/maintainers to include it. Then the next guy won't have this problem.
I'm trying, I also realized I made a mistake. The original plex method used in gentoo is no longer valid. I was using the plex-overlay. The relavent files are located at https://github.com/comio/plex-overlay/tree/master/media-tv/plex-media-server for anyone that may wish to chime in. The python sandbox doesn't seem to be used any longer, so should be simpler to implement if I can work out how to apply them.

Edit: Actually, taking the conf.d and init.d from the plex-overlay, it just works, 0 modification is needed to the build.