Giter Club home page Giter Club logo

Comments (4)

drzoidberg33 avatar drzoidberg33 commented on May 22, 2024

Hi @DeviantEng

I haven't tested on Centos 7 but I do have it running like you are asking on my Centos 6.6 box at home. Here the cache and log folders are placed in my specified path.

I've hardly worked at all with systemd so unfortunately cannot give much insight there, but below are examples of my init script and config for reference, might help out.

Here is an example of my config (/etc/sysconfig/plexpy):

# PlexPy service configuration

#run PlexPy as
PP_USER=myuser

PP_HOME=/home/myuser/.python_apps/plexpy

PP_PIDFILE=/var/run/plexpy/plexpy.pid

PP_DATA=/home/myuser/.python_apps/AppData/plexpy

PP_CONFIG=/home/myuser/.python_apps/AppData/plexpy/config.ini

PYTHON_BIN=/usr/local/bin/python2.7

#gui address, eg: ${protocol}://${host}:${port}/plexpy/
protocol=http
host=0.0.0.0
port=8181

#leave blank if no username/password is required to access the gui
username=
password=

#use nice, ionice, taskset to start PlexPy
nicecmd=
#  example: nicecmd="nice -n 19 ionice -c3"

And here is my init script (/etc/init.d/plexpy):

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          plexpy
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts PlexPy
# Description:       starts PlexPy
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source PlexPy configuration
if [ -f /etc/sysconfig/plexpy ]; then
        . /etc/sysconfig/plexpy
fi

prog=plexpy
lockfile=/var/lock/subsys/$prog

## Edit user configuation in /etc/sysconfig/plexpy to change
## the defaults
username=${PP_USER-plexpy}
homedir=${PP_HOME-/opt/plexpy}
datadir=${PP_DATA-/opt/plexpy}
configfile=${PP_CONFIG-/opt/plexpy}
pidfile=${PP_PIDFILE-/var/run/plexpy/plexpy.pid}
nice=${PP_NICE-}
python_bin=${PYTHON_BIN-/usr/local/python}
##

pidpath=`dirname ${pidfile}`
options=" --daemon --quiet --nolaunch --config ${configfile} --pidfile ${pidfile} --datadir ${datadir}"

# create PID directory if not exist and ensure the PlexPy user can write to it
if [ ! -d $pidpath ]; then
        mkdir -p $pidpath
        chown $username $pidpath
fi

if [ ! -d $datadir ]; then
        mkdir -p $datadir
        chown $username $datadir
fi

start() {
        # Start daemon.
        echo -n $"Starting $prog: "
        daemon --user=${username} --pidfile=${pidfile} ${nice} ${python_bin} ${homedir}/PlexPy.py ${options}
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $lockfile
        return $RETVAL
}


stop() {
        echo -n $"Shutting down $prog: "
        killproc -p ${pidfile} ${python_bin}
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        return $RETVAL
}

rh_status() {
    # run checks to determine if the service is running or use generic status

    /usr/bin/nc -z $host $port &> /dev/null
    retval=$?

    if [ $retval -eq 0 ];then
        pid=`ps -fu ${username} | grep -v grep | grep PlexPy.py | awk '{print $2}'`
        echo "$prog (pid $pid) is running..."
        return $retval
    else
        echo "$prog is stopped"
        return $retval
    fi

}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
#       status $prog
        rh_status
        ;;
  restart|force-reload)
        stop
        start
        ;;
  try-restart|condrestart)
        if status $prog > /dev/null; then
            stop
            start
        fi
        ;;
  reload)
        exit 3
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
        exit 2
esac

Here is my directory listing to show the folder locations:

[root@home home]# ls -alrt -d -1 /home/myuser/.python_apps/AppData/plexpy/{*,.*}
drwxr-xr-x 6 myuser myuser    4096 Jul 30 12:49 /home/myuser/.python_apps/AppData/plexpy/..
drwxr-xr-x 2 myuser myuser    4096 Jul 30 12:49 /home/myuser/.python_apps/AppData/plexpy/logs
drwxr-xr-x 2 myuser myuser    4096 Jul 30 12:49 /home/myuser/.python_apps/AppData/plexpy/cache
-rw-r--r-- 1 myuser myuser      40 Aug  5 19:12 /home/myuser/.python_apps/AppData/plexpy/version.lock
-rw-r--r-- 1 myuser myuser    4108 Aug  6 07:12 /home/myuser/.python_apps/AppData/plexpy/config.ini
-rw-r--r-- 1 myuser myuser 4519936 Aug  6 07:12 /home/myuser/.python_apps/AppData/plexpy/plexpy.db
drwxr-xr-x 4 myuser myuser    4096 Aug  6 16:12 /home/myuser/.python_apps/AppData/plexpy/.

from tautulli.

DeviantEng avatar DeviantEng commented on May 22, 2024

Very interesting. Not sure what my issue is then, but I just re-installed in /opt and it's working fine.

So another question, is there a way that I can get the History list outputed to a text file?

from tautulli.

drzoidberg33 avatar drzoidberg33 commented on May 22, 2024

There isn't currently a way to do that.

from tautulli.

drzoidberg33 avatar drzoidberg33 commented on May 22, 2024

I'm closing this as your issue has been resolved.

from tautulli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.