#!/bin/sh #defaults - change these parameters in /etc/conf.d/plexmediaserver export PLEX_MEDIA_SERVER_USER=plex export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 export PLEX_MEDIA_SERVER_HOME=/opt/plexmediaserver export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000 export PLEX_MEDIA_SERVER_TMPDIR=/tmp export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_HOME}/Library/Application Support" test -f /etc/conf.d/plexmediaserver && . /etc/conf.d/plexmediaserver if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ] then mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" chown -R ${PLEX_MEDIA_SERVER_USER} "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" if [ ! $? -eq 0 ] then echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!" exit 1 fi fi if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Linux/arm/Frameworks/" ] then mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Linux/arm/Frameworks/" chown -R ${PLEX_MEDIA_SERVER_USER} "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Linux/arm/Frameworks/" if [ ! $? -eq 0 ] then echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Linux/arm/Frameworks, MAKE SURE I HAVE PERMISSON TO DO THAT!" exit 1 fi fi if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Logs" ] then mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Logs" chown -R ${PLEX_MEDIA_SERVER_USER} "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Logs" if [ ! $? -eq 0 ] then echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server/Logs, MAKE SURE I HAVE PERMISSON TO DO THAT!" exit 1 fi fi export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}" export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}" ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE cd ${PLEX_MEDIA_SERVER_HOME}; su -c "${PLEX_MEDIA_SERVER_HOME}/Plex\ Media\ Server &" ${PLEX_MEDIA_SERVER_USER}