KalleDK/plexmediaserver_port — pull request #5 by felderado (2013-07-06 15:51:51+00:00)
Title: final changes

I think this is about the best we can do. Maybe some minor tweaks but I'm totally burnt out on trying to make Plex play nice. I've simply run out of ideas that conform to the freebsd rc framework.

The main issues are the usage of spaces in the path to pid and binary name (Plex Media Server). This is just bad design, and hopefully we can convince Elan to stop doing that.

My other problem is that on shutdown it doesn't nicely clean up after itself. A final "pkill -9 -f plexmediaserver" matches all plugin processes hanging around and wipes them out too. If you feel like putting in some effort to do that a bit cleaner that would be fine. I know you had a more complicated shutdown sequence at one point but I haven't looked back at it to see if there is something we should use from it again.

I've avoided the start.sh script entirely. I don't see a need for it. We can export those variables in the precmd routine in the rc script and run the binary directly. It's much cleaner that way. It also gives us the ability in the future to make a few of those settings variables we can put in rc.conf if people want to play with MAX_PLUGIN_PROCS, for example.

Finally, the symlinking of the pidfile to /var/run/plex.pid was inspired from a RedHat/CentOS init script for Plex. They do that as well, likely for the same reason -- stupid spaces in the path to the pidfile.

Hopefully this all makes sense to you. The port is complete, functional and compliant, but far from ideal. Plex simply doesn't behave in a sane manner it seems, so this is the best we have to work with.

I've been streaming some videos from FreeBSD and it's been great! Can't wait for a final release we can commit to ports!