--- /dev/null
+# 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"
--- /dev/null
+#!/sbin/openrc-run
+
+depend() {
+ need avahi-daemon
+}
+
+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 $?
+}
--- /dev/null
+# default script for Plex Media Server
+
+# the number of plugins that can run at the same time
+export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
+
+# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
+
+# where the mediaserver should store the transcodes
+export PLEX_MEDIA_SERVER_TMPDIR=/tmp
+
+# uncomment to set it to something else
+# export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application Support"
+
+# the user that PMS should run as, defaults to 'plex'
+# note that if you change this you might need to move
+# the Application Support directory to not lose your
+# media library (match what is in /etc/passwd)
+export PLEX_MEDIA_SERVER_USER=plex
+
+# Uncomment this to use syslog for logging instead of
+# sending logs to Plex Media Server.log
+#export PLEX_MEDIA_SERVER_USE_SYSLOG=true