mirror of
https://github.com/spritsail/plex-media-server.git
synced 2024-11-05 01:16:23 +00:00
55 lines
2.0 KiB
Diff
55 lines
2.0 KiB
Diff
--- start_pms
|
|
+++ /usr/bin/start_pms
|
|
@@ -1,17 +1,12 @@
|
|
#!/bin/sh
|
|
|
|
-#change these parameters in /etc/default/plexmediaserver
|
|
-export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
|
|
-export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
|
|
-export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
|
|
-export PLEX_MEDIA_SERVER_TMPDIR=/tmp
|
|
-export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application Support"
|
|
-if [ -f /etc/default/locale ]; then
|
|
- export LANG="`cat /etc/default/locale|awk -F '=' '/LANG=/{print $2}'|sed 's/"//g'`"
|
|
- export LC_ALL="$LANG"
|
|
-fi
|
|
-
|
|
-test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
|
|
+# Default values
|
|
+export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="${PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS:-6}"
|
|
+export PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME:-/usr/lib/plexmediaserver}"
|
|
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-3000}"
|
|
+export PLEX_MEDIA_SERVER_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
|
|
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}"
|
|
+export PLEX_MEDIA_SERVER_CONFIG_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server"
|
|
|
|
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
|
|
then
|
|
@@ -22,15 +17,18 @@
|
|
exit 1
|
|
fi
|
|
fi
|
|
+if [ ! -w "$PLEX_MEDIA_SERVER_CONFIG_DIR" ]
|
|
+then
|
|
+ echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!"
|
|
+ exit 2
|
|
+fi
|
|
|
|
-export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
|
|
+export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:$LD_LIBRARY_PATH"
|
|
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
|
|
|
|
-echo $PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS $PLEX_MEDIA_SERVER_MAX_STACK_SIZE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR
|
|
-
|
|
-ulimit -s $PLEX_MAX_STACK_SIZE
|
|
-
|
|
-# Add sleep - Possible fix for start on boot.
|
|
-sleep 3
|
|
+PIDFILE="${PLEX_MEDIA_SERVER_CONFIG_DIR}/plexmediaserver.pid"
|
|
+if [ -f "$PIDFILE" ]; then
|
|
+ rm -f "$PIDFILE"
|
|
+fi
|
|
|
|
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
|
|
+exec "$PLEX_MEDIA_SERVER_HOME/Plex Media Server"
|