Update all init scripts to Tautulli

This commit is contained in:
JonnyWong16 2018-03-04 09:44:02 -08:00
parent 9d08717c83
commit 403e8dfbea
9 changed files with 172 additions and 172 deletions

View file

@ -1,54 +1,54 @@
#!/bin/sh #!/bin/sh
# #
# PROVIDE: plexpy # PROVIDE: tautulli
# REQUIRE: plexpy # REQUIRE: tautulli
# KEYWORD: shutdown # KEYWORD: shutdown
# #
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service: # to enable this service:
# #
# plexpy_enable (bool): Set to NO by default. # tautulli_enable (bool): Set to NO by default.
# Set it to YES to enable it. # Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what # tautulli_user: The user account Tautulli daemon runs as what
# you want it to be. It uses 'plexpy' user by # you want it to be. It uses 'tautulli' user by
# default. Do not sets it as empty or it will run # default. Do not sets it as empty or it will run
# as root. # as root.
# plexpy_dir: Directory where PlexPy lives. # tautulli_dir: Directory where Tautulli lives.
# Default: /usr/local/plexpy # Default: /usr/local/share/Tautulli
# plexpy_chdir: Change to this directory before running PlexPy. # tautulli_chdir: Change to this directory before running Tautulli.
# Default is same as plexpy_dir. # Default is same as tautulli_dir.
# plexpy_pid: The name of the pidfile to create. # tautulli_pid: The name of the pidfile to create.
# Default is plexpy.pid in plexpy_dir. # Default is tautulli.pid in tautulli_dir.
. /etc/rc.subr . /etc/rc.subr
name="plexpy" name="tautulli"
rcvar=${name}_enable rcvar=${name}_enable
load_rc_config ${name} load_rc_config ${name}
: ${plexpy_enable:="NO"} : ${tautulli_enable:="NO"}
: ${plexpy_user:="plexpy"} : ${tautulli_user:="tautulli"}
: ${plexpy_dir:="/usr/local/plexpy"} : ${tautulli_dir:="/usr/local/share/Tautulli"}
: ${plexpy_chdir:="${plexpy_dir}"} : ${tautulli_chdir:="${tautulli_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"} : ${tautulli_pid:="${tautulli_dir}/tautulli.pid"}
: ${plexpy_conf:="${plexpy_dir}/config.ini"} : ${tautulli_conf:="${tautulli_dir}/config.ini"}
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown PlexPy. WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown Tautulli.
if [ -e "${plexpy_conf}" ]; then if [ -e "${tautulli_conf}" ]; then
HOST=`grep -A64 "\[General\]" "${plexpy_conf}"|egrep "^http_host"|perl -wple 's/^http_host = (.*)$/$1/'` HOST=`grep -A64 "\[General\]" "${tautulli_conf}"|egrep "^http_host"|perl -wple 's/^http_host = (.*)$/$1/'`
PORT=`grep -A64 "\[General\]" "${plexpy_conf}"|egrep "^http_port"|perl -wple 's/^http_port = (.*)$/$1/'` PORT=`grep -A64 "\[General\]" "${tautulli_conf}"|egrep "^http_port"|perl -wple 's/^http_port = (.*)$/$1/'`
fi fi
status_cmd="${name}_status" status_cmd="${name}_status"
stop_cmd="${name}_stop" stop_cmd="${name}_stop"
command="${plexpy_dir}/PlexPy.py" command="${tautulli_dir}/PlexPy.py"
command_args="--daemon --quiet --nolaunch --port ${PORT} --pidfile ${plexpy_pid} --config ${plexpy_conf}" command_args="--daemon --quiet --nolaunch --port ${PORT} --pidfile ${tautulli_pid} --config ${tautulli_conf}"
# Check for wget and refuse to start without it. # Check for wget and refuse to start without it.
if [ ! -x "${WGET}" ]; then if [ ! -x "${WGET}" ]; then
warn "PlexPy not started: You need wget to safely shut down PlexPy." warn "Tautulli not started: You need wget to safely shut down Tautulli."
exit 1 exit 1
fi fi
@ -58,21 +58,21 @@ if [ `id -u` != "0" ]; then
exit 1 exit 1
fi fi
verify_plexpy_pid() { verify_tautulli_pid() {
# Make sure the pid corresponds to the PlexPy process. # Make sure the pid corresponds to the Tautulli process.
pid=`cat ${plexpy_pid} 2>/dev/null` pid=`cat ${tautulli_pid} 2>/dev/null`
ps -p ${pid} | grep -q "python ${plexpy_dir}/PlexPy.py" ps -p ${pid} | grep -q "python ${tautulli_dir}/PlexPy.py"
return $? return $?
} }
# Try to stop PlexPy cleanly by calling shutdown over http. # Try to stop Tautulli cleanly by calling shutdown over http.
plexpy_stop() { tautulli_stop() {
if [ ! -e "${plexpy_conf}" ]; then if [ ! -e "${tautulli_conf}" ]; then
echo "PlexPy' settings file does not exist. Try starting PlexPy, as this should create the file." echo "Tautulli' settings file does not exist. Try starting Tautulli, as this should create the file."
exit 1 exit 1
fi fi
echo "Stopping $name" echo "Stopping $name"
verify_plexpy_pid verify_tautulli_pid
${WGET} -O - -q --user=${SBUSR} --password=${SBPWD} "http://${HOST}:${PORT}/shutdown/" >/dev/null ${WGET} -O - -q --user=${SBUSR} --password=${SBPWD} "http://${HOST}:${PORT}/shutdown/" >/dev/null
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
@ -81,8 +81,8 @@ plexpy_stop() {
fi fi
} }
plexpy_status() { tautulli_status() {
verify_plexpy_pid && echo "$name is running as ${pid}" || echo "$name is not running" verify_tautulli_pid && echo "$name is running as ${pid}" || echo "$name is not running"
} }
run_rc_command "$1" run_rc_command "$1"

View file

@ -1,25 +1,25 @@
#!/bin/sh #!/bin/sh
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: PlexPy # Provides: Tautulli
# Required-Start: $all # Required-Start: $all
# Required-Stop: $all # Required-Stop: $all
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: starts PlexPy # Short-Description: starts Tautulli
# Description: starts PlexPy # Description: starts Tautulli
### END INIT INFO ### END INIT INFO
# Source function library. # Source function library.
. /etc/init.d/functions . /etc/init.d/functions
## Variables ## Variables
prog=plexpy prog=tautulli
lockfile=/var/lock/subsys/$prog lockfile=/var/lock/subsys/$prog
homedir=/opt/plexpy homedir=/opt/Tautulli
datadir=/opt/plexpy datadir=/opt/Tautulli
configfile=/opt/plexpy/config.ini configfile=/opt/Tautulli/config.ini
pidfile=/var/run/plexpy.pid pidfile=/var/run/tautulli.pid
nice= nice=
# The following line must point to your Python 2.7 install # The following line must point to your Python 2.7 install
python27=/usr/src/Python-2.7.11/python python27=/usr/src/Python-2.7.11/python

View file

@ -1,45 +1,45 @@
#!/bin/sh #!/bin/sh
# #
# PROVIDE: plexpy # PROVIDE: tautulli
# REQUIRE: DAEMON plexpy # REQUIRE: DAEMON tautulli
# KEYWORD: shutdown # KEYWORD: shutdown
# #
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service: # to enable this service:
# #
# plexpy_enable (bool): Set to NO by default. # tautulli_enable (bool): Set to NO by default.
# Set it to YES to enable it. # Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what # tautulli_user: The user account Tautulli daemon runs as what
# you want it to be. It uses 'plexpy' user by # you want it to be. It uses 'tautulli' user by
# default. Do not sets it as empty or it will run # default. Do not sets it as empty or it will run
# as root. # as root.
# plexpy_dir: Directory where PlexPy lives. # tautulli_dir: Directory where Tautulli lives.
# Default: /usr/local/share/plexpy # Default: /usr/local/share/Tautulli
# plexpy_chdir: Change to this directory before running PlexPy. # tautulli_chdir: Change to this directory before running Tautulli.
# Default is same as plexpy_dir. # Default is same as tautulli_dir.
# plexpy_pid: The name of the pidfile to create. # tautulli_pid: The name of the pidfile to create.
# Default is plexpy.pid in plexpy_dir. # Default is tautulli.pid in tautulli_dir.
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
. /etc/rc.subr . /etc/rc.subr
name="plexpy" name="tautulli"
rcvar=${name}_enable rcvar=${name}_enable
load_rc_config ${name} load_rc_config ${name}
: ${plexpy_enable:="NO"} : ${tautulli_enable:="NO"}
: ${plexpy_user:="plexpy"} : ${tautulli_user:="tautulli"}
: ${plexpy_dir:="/usr/local/share/plexpy"} : ${tautulli_dir:="/usr/local/share/Tautulli"}
: ${plexpy_chdir:="${plexpy_dir}"} : ${tautulli_chdir:="${tautulli_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"} : ${tautulli_pid:="${tautulli_dir}/tautulli.pid"}
: ${plexpy_flags:=""} : ${tautulli_flags:=""}
status_cmd="${name}_status" status_cmd="${name}_status"
stop_cmd="${name}_stop" stop_cmd="${name}_stop"
command="${plexpy_dir}/PlexPy.py" command="${tautulli_dir}/PlexPy.py"
command_args="--daemon --pidfile ${plexpy_pid} --quiet --nolaunch ${plexpy_flags}" command_args="--daemon --pidfile ${tautulli_pid} --quiet --nolaunch ${tautulli_flags}"
# Ensure user is root when running this script. # Ensure user is root when running this script.
if [ `id -u` != "0" ]; then if [ `id -u` != "0" ]; then
@ -47,21 +47,21 @@ if [ `id -u` != "0" ]; then
exit 1 exit 1
fi fi
verify_plexpy_pid() { verify_tautulli_pid() {
# Make sure the pid corresponds to the PlexPy process. # Make sure the pid corresponds to the Tautulli process.
if [ -f ${plexpy_pid} ]; then if [ -f ${tautulli_pid} ]; then
pid=`cat ${plexpy_pid} 2>/dev/null` pid=`cat ${tautulli_pid} 2>/dev/null`
ps -p ${pid} | grep -q "python2 ${plexpy_dir}/PlexPy.py" ps -p ${pid} | grep -q "python2 ${tautulli_dir}/PlexPy.py"
return $? return $?
else else
return 0 return 0
fi fi
} }
# Try to stop PlexPy cleanly by sending SIGTERM # Try to stop Tautulli cleanly by sending SIGTERM
plexpy_stop() { tautulli_stop() {
echo "Stopping $name" echo "Stopping $name"
verify_plexpy_pid verify_tautulli_pid
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
kill ${pid} kill ${pid}
wait_for_pids ${pid} wait_for_pids ${pid}
@ -69,8 +69,8 @@ plexpy_stop() {
fi fi
} }
plexpy_status() { tautulli_status() {
verify_plexpy_pid verify_tautulli_pid
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
echo "$name is running as ${pid}." echo "$name is running as ${pid}."
else else

View file

@ -1,45 +1,45 @@
#!/bin/sh #!/bin/sh
# #
# PROVIDE: plexpy # PROVIDE: tautulli
# REQUIRE: DAEMON plexpy # REQUIRE: DAEMON tautulli
# KEYWORD: shutdown # KEYWORD: shutdown
# #
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service: # to enable this service:
# #
# plexpy_enable (bool): Set to NO by default. # tautulli_enable (bool): Set to NO by default.
# Set it to YES to enable it. # Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what # tautulli_user: The user account Tautulli daemon runs as what
# you want it to be. It uses 'plexpy' user by # you want it to be. It uses 'tautulli' user by
# default. Do not sets it as empty or it will run # default. Do not sets it as empty or it will run
# as root. # as root.
# plexpy_dir: Directory where PlexPy lives. # tautulli_dir: Directory where Tautulli lives.
# Default: /usr/local/share/plexpy # Default: /usr/local/share/tautulli
# plexpy_chdir: Change to this directory before running PlexPy. # tautulli_chdir: Change to this directory before running Tautulli.
# Default is same as plexpy_dir. # Default is same as tautulli_dir.
# plexpy_pid: The name of the pidfile to create. # tautulli_pid: The name of the pidfile to create.
# Default is plexpy.pid in plexpy_dir. # Default is tautulli.pid in tautulli_dir.
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
. /etc/rc.subr . /etc/rc.subr
name="plexpy" name="tautulli"
rcvar=${name}_enable rcvar=${name}_enable
load_rc_config ${name} load_rc_config ${name}
: ${plexpy_enable:="NO"} : ${tautulli_enable:="NO"}
: ${plexpy_user:="plexpy"} : ${tautulli_user:="tautulli"}
: ${plexpy_dir:="/usr/local/share/plexpy"} : ${tautulli_dir:="/usr/local/share/tautulli"}
: ${plexpy_chdir:="${plexpy_dir}"} : ${tautulli_chdir:="${tautulli_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"} : ${tautulli_pid:="${tautulli_dir}/tautulli.pid"}
: ${plexpy_flags:=""} : ${tautulli_flags:=""}
status_cmd="${name}_status" status_cmd="${name}_status"
stop_cmd="${name}_stop" stop_cmd="${name}_stop"
command="${plexpy_dir}/PlexPy.py" command="${tautulli_dir}/PlexPy.py"
command_args="--daemon --pidfile ${plexpy_pid} --quiet --nolaunch ${plexpy_flags}" command_args="--daemon --pidfile ${tautulli_pid} --quiet --nolaunch ${tautulli_flags}"
# Ensure user is root when running this script. # Ensure user is root when running this script.
if [ `id -u` != "0" ]; then if [ `id -u` != "0" ]; then
@ -47,21 +47,21 @@ if [ `id -u` != "0" ]; then
exit 1 exit 1
fi fi
verify_plexpy_pid() { verify_tautulli_pid() {
# Make sure the pid corresponds to the PlexPy process. # Make sure the pid corresponds to the Tautulli process.
if [ -f ${plexpy_pid} ]; then if [ -f ${tautulli_pid} ]; then
pid=`cat ${plexpy_pid} 2>/dev/null` pid=`cat ${tautulli_pid} 2>/dev/null`
ps -p ${pid} | grep -q "python2 ${plexpy_dir}/PlexPy.py" ps -p ${pid} | grep -q "python2 ${tautulli_dir}/PlexPy.py"
return $? return $?
else else
return 0 return 0
fi fi
} }
# Try to stop PlexPy cleanly by sending SIGTERM # Try to stop Tautulli cleanly by sending SIGTERM
plexpy_stop() { tautulli_stop() {
echo "Stopping $name." echo "Stopping $name."
verify_plexpy_pid verify_tautulli_pid
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
kill ${pid} kill ${pid}
wait_for_pids ${pid} wait_for_pids ${pid}
@ -69,8 +69,8 @@ plexpy_stop() {
fi fi
} }
plexpy_status() { tautulli_status() {
verify_plexpy_pid verify_tautulli_pid
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
echo "$name is running as ${pid}." echo "$name is running as ${pid}."
else else

View file

@ -3,12 +3,12 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>Label</key> <key>Label</key>
<string>plexpy</string> <string>tautulli</string>
<key>ProgramArguments</key> <key>ProgramArguments</key>
<array> <array>
<!-- Modify these two lines if you need to to reflect your python location and PlexPy install location --> <!-- Modify these two lines if you need to to reflect your python location and Tautulli install location -->
<string>/usr/bin/python</string> <string>/usr/bin/python</string>
<string>/Applications/PlexPy/PlexPy.py</string> <string>/Applications/Tautulli/PlexPy.py</string>
</array> </array>
<key>RunAtLoad</key> <key>RunAtLoad</key>
<true/> <true/>

View file

@ -2,9 +2,9 @@
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!-- <!--
Created by Manifold Created by Manifold
--><service_bundle type="manifest" name="plexpy"> --><service_bundle type="manifest" name="tautulli">
<service name="application/plexpy" type="service" version="1"> <service name="application/tautulli" type="service" version="1">
<create_default_instance enabled="true"/> <create_default_instance enabled="true"/>
@ -19,10 +19,10 @@
</dependency> </dependency>
<method_context> <method_context>
<method_credential user="plexpy" group="nogroup"/> <method_credential user="tautulli" group="nogroup"/>
</method_context> </method_context>
<exec_method type="method" name="start" exec="python /opt/plexpy/PlexPy.py --daemon --quiet --nolaunch" timeout_seconds="60"/> <exec_method type="method" name="start" exec="python /opt/tautulli/PlexPy.py --daemon --quiet --nolaunch" timeout_seconds="60"/>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/> <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
@ -37,7 +37,7 @@
<template> <template>
<common_name> <common_name>
<loctext xml:lang="C"> <loctext xml:lang="C">
PlexPy Tautulli
</loctext> </loctext>
</common_name> </common_name>
</template> </template>

View file

@ -1,11 +1,11 @@
# PlexPy - Stats for Plex Media Server usage # Tautulli - Stats for Plex Media Server usage
# #
# Service Unit file for systemd system manager # Service Unit file for systemd system manager
# #
# INSTALLATION NOTES # INSTALLATION NOTES
# #
# 1. Rename this file as you want, ensuring that it ends in .service # 1. Rename this file as you want, ensuring that it ends in .service
# e.g. 'plexpy.service' # e.g. 'tautulli.service'
# #
# 2. Adjust configuration settings as required. More details in the # 2. Adjust configuration settings as required. More details in the
# "CONFIGURATION NOTES" section shown below. # "CONFIGURATION NOTES" section shown below.
@ -15,39 +15,39 @@
# #
# 4. Enable boot-time autostart with the following commands: # 4. Enable boot-time autostart with the following commands:
# systemctl daemon-reload # systemctl daemon-reload
# systemctl enable plexpy.service # systemctl enable tautulli.service
# #
# 5. Start now with the following command: # 5. Start now with the following command:
# systemctl start plexpy.service # systemctl start tautulli.service
# #
# CONFIGURATION NOTES # CONFIGURATION NOTES
# #
# - The example settings in this file assume that you will run PlexPy as user: plexpy # - The example settings in this file assume that you will run Tautulli as user: tautulli
# - To create this user and give it ownership of the plexpy directory: # - To create this user and give it ownership of the tautulli directory:
# sudo adduser --system --no-create-home plexpy # sudo adduser --system --no-create-home tautulli
# sudo chown plexpy:nogroup -R /opt/plexpy # sudo chown tautulli:nogroup -R /opt/tautulli
# #
# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive) # - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive)
# #
# - Adjust ExecStart= to point to: # - Adjust ExecStart= to point to:
# 1. Your PlexPy executable, # 1. Your Tautulli executable,
# 2. Your config file (recommended is to put it somewhere in /etc) # 2. Your config file (recommended is to put it somewhere in /etc)
# 3. Your datadir (recommended is to NOT put it in your PlexPy exec dir) # 3. Your datadir (recommended is to NOT put it in your Tautulli exec dir)
# #
# - Adjust User= and Group= to the user/group you want PlexPy to run as. # - Adjust User= and Group= to the user/group you want Tautulli to run as.
# #
# - WantedBy= specifies which target (i.e. runlevel) to start PlexPy for. # - WantedBy= specifies which target (i.e. runlevel) to start Tautulli for.
# multi-user.target equates to runlevel 3 (multi-user text mode) # multi-user.target equates to runlevel 3 (multi-user text mode)
# graphical.target equates to runlevel 5 (multi-user X11 graphical mode) # graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
[Unit] [Unit]
Description=PlexPy - Stats for Plex Media Server usage Description=Tautulli - Stats for Plex Media Server usage
[Service] [Service]
ExecStart=/opt/plexpy/PlexPy.py --quiet --daemon --nolaunch --config /opt/plexpy/config.ini --datadir /opt/plexpy ExecStart=/opt/tautulli/PlexPy.py --quiet --daemon --nolaunch --config /opt/tautulli/config.ini --datadir /opt/tautulli
GuessMainPID=no GuessMainPID=no
Type=forking Type=forking
User=plexpy User=tautulli
Group=nogroup Group=nogroup
[Install] [Install]

View file

@ -1,71 +1,71 @@
#!/bin/sh #!/bin/sh
# #
## Don't edit this file ## Don't edit this file
## Edit user configuation in /etc/default/plexpy to change ## Edit user configuation in /etc/default/tautulli to change
## ##
## Make sure init script is executable ## Make sure init script is executable
## sudo chmod +x /path/to/init.ubuntu ## sudo chmod +x /path/to/init.ubuntu
## ##
## Install the init script ## Install the init script
## sudo ln -s /path/to/init.ubuntu /etc/init.d/plexpy ## sudo ln -s /path/to/init.ubuntu /etc/init.d/tautulli
## ##
## Create the plexpy daemon user: ## Create the tautulli daemon user:
## sudo adduser --system --no-create-home plexpy ## sudo adduser --system --no-create-home tautulli
## ##
## Make sure /opt/plexpy is owned by the plexpy user ## Make sure /opt/Tautulli is owned by the tautulli user
## sudo chown plexpy:nogroup -R /opt/plexpy ## sudo chown tautulli:nogroup -R /opt/Tautulli
## ##
## Touch the default file to stop the warning message when starting ## Touch the default file to stop the warning message when starting
## sudo touch /etc/default/plexpy ## sudo touch /etc/default/tautulli
## ##
## To start PlexPy automatically ## To start Tautulli automatically
## sudo update-rc.d plexpy defaults ## sudo update-rc.d tautulli defaults
## ##
## To start/stop/restart PlexPy ## To start/stop/restart Tautulli
## sudo service plexpy start ## sudo service tautulli start
## sudo service plexpy stop ## sudo service tautulli stop
## sudo service plexpy restart ## sudo service tautulli restart
## ##
## HP_USER= #$RUN_AS, username to run plexpy under, the default is plexpy ## HP_USER= #$RUN_AS, username to run Tautulli under, the default is tautulli
## HP_HOME= #$APP_PATH, the location of PlexPy.py, the default is /opt/plexpy ## HP_HOME= #$APP_PATH, the location of PlexPy.py, the default is /opt/Tautulli
## HP_DATA= #$DATA_DIR, the location of plexpy.db, cache, logs, the default is /opt/plexpy ## HP_DATA= #$DATA_DIR, the location of plexpy.db, cache, logs, the default is /opt/Tautulli
## HP_PIDFILE= #$PID_FILE, the location of plexpy.pid, the default is /var/run/plexpy/plexpy.pid ## HP_PIDFILE= #$PID_FILE, the location of tautulli.pid, the default is /var/run/tautulli/tautulli.pid
## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python ## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python
## HP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for plexpy, i.e. " --config=/home/plexpy/config.ini" ## HP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for Tautulli, i.e. " --config=/home/Tautulli/config.ini"
## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users" ## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users"
## HP_PORT= #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini ## HP_PORT= #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini
## ##
## EXAMPLE if want to run as different user ## EXAMPLE if want to run as different user
## add HP_USER=username to /etc/default/plexpy ## add HP_USER=username to /etc/default/tautulli
## otherwise default plexpy is used ## otherwise default tautulli is used
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: plexpy # Provides: tautulli
# Required-Start: $local_fs $network $remote_fs # Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager # Should-Start: $NetworkManager
# Should-Stop: $NetworkManager # Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: starts instance of PlexPy # Short-Description: starts instance of Tautulli
# Description: starts instance of PlexPy using start-stop-daemon # Description: starts instance of Tautulli using start-stop-daemon
### END INIT INFO ### END INIT INFO
# Script name # Script name
NAME=plexpy NAME=tautulli
# App name # App name
DESC=PlexPy DESC=Tautulli
SETTINGS_LOADED=FALSE SETTINGS_LOADED=FALSE
. /lib/lsb/init-functions . /lib/lsb/init-functions
# Source PlexPy configuration # Source Tautulli configuration
if [ -f /etc/default/plexpy ]; then if [ -f /etc/default/tautulli ]; then
SETTINGS=/etc/default/plexpy SETTINGS=/etc/default/tautulli
else else
log_warning_msg "/etc/default/plexpy not found using default settings."; log_warning_msg "/etc/default/tautulli not found using default settings.";
fi fi
check_retval() { check_retval() {
@ -84,21 +84,21 @@ load_settings() {
## The defaults ## The defaults
# Run as username # Run as username
RUN_AS=${HP_USER-plexpy} RUN_AS=${HP_USER-tautulli}
# Path to app HP_HOME=path_to_app_PlexPy.py # Path to app HP_HOME=path_to_app_PlexPy.py
APP_PATH=${HP_HOME-/opt/plexpy} APP_PATH=${HP_HOME-/opt/Tautulli}
# Data directory where plexpy.db, cache and logs are stored # Data directory where plexpy.db, cache and logs are stored
DATA_DIR=${HP_DATA-/opt/plexpy} DATA_DIR=${HP_DATA-/opt/Tautulli}
# Path to store PID file # Path to store PID file
PID_FILE=${HP_PIDFILE-/var/run/plexpy/plexpy.pid} PID_FILE=${HP_PIDFILE-/var/run/tautulli/tautulli.pid}
# Path to python bin # Path to python bin
DAEMON=${PYTHON_BIN-/usr/bin/python} DAEMON=${PYTHON_BIN-/usr/bin/python}
# Extra daemon option like: HP_OPTS=" --config=/home/plexpy/config.ini" # Extra daemon option like: HP_OPTS=" --config=/home/Tautulli/config.ini"
EXTRA_DAEMON_OPTS=${HP_OPTS-} EXTRA_DAEMON_OPTS=${HP_OPTS-}
# Extra start-stop-daemon option like START_OPTS=" --group=users" # Extra start-stop-daemon option like START_OPTS=" --group=users"
@ -162,7 +162,7 @@ handle_updates () {
return 0; } return 0; }
} }
start_plexpy () { start_tautulli () {
handle_pid handle_pid
handle_datadir handle_datadir
handle_updates handle_updates
@ -175,7 +175,7 @@ start_plexpy () {
fi fi
} }
stop_plexpy () { stop_tautulli () {
if is_running; then if is_running; then
log_daemon_msg "Stopping $DESC" log_daemon_msg "Stopping $DESC"
start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15 start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15
@ -187,14 +187,14 @@ stop_plexpy () {
case "$1" in case "$1" in
start) start)
start_plexpy start_tautulli
;; ;;
stop) stop)
stop_plexpy stop_tautulli
;; ;;
restart|force-reload) restart|force-reload)
stop_plexpy stop_tautulli
start_plexpy start_tautulli
;; ;;
status) status)
status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC" status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC"

View file

@ -1,14 +1,14 @@
# plexpy # tautulli
# #
# This is a session/user job. Install this file into /usr/share/upstart/sessions # This is a session/user job. Install this file into /usr/share/upstart/sessions
# if plexpy is installed system wide, and into $XDG_CONFIG_HOME/upstart if # if Tautulli is installed system wide, and into $XDG_CONFIG_HOME/upstart if
# plexpy is installed per user. Change the executable path appropiately. # Tautulli is installed per user. Change the executable path appropiately.
start on desktop-start start on desktop-start
stop on desktop-end stop on desktop-end
env CONFIG=""$XDG_CONFIG_HOME"/plexpy" env CONFIG=""$XDG_CONFIG_HOME"/Tautulli"
env DATA=""$XDG_DATA_HOME"/plexpy" env DATA=""$XDG_DATA_HOME"/Tautulli"
pre-start script pre-start script
[ -d "$CONFIG" ] || mkdir -p "$CONFIG" [ -d "$CONFIG" ] || mkdir -p "$CONFIG"