From 503f7d715f9429f7dafd47835bd3017cdee089c7 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 19 Nov 2015 12:39:53 +0800 Subject: [PATCH 1/2] Change to move init-scripts to single folder --- CHANGES.md | 1 + init.debian => init-scripts/init.debian | 0 init.fedora => init-scripts/init.fedora | 0 init.freebsd => init-scripts/init.freebsd | 0 init.gentoo => init-scripts/init.gentoo | 0 init.solaris11 => init-scripts/init.solaris11 | 0 init.systemd => init-scripts/init.systemd | 0 init.ubuntu => init-scripts/init.ubuntu | 0 8 files changed, 1 insertion(+) rename init.debian => init-scripts/init.debian (100%) rename init.fedora => init-scripts/init.fedora (100%) rename init.freebsd => init-scripts/init.freebsd (100%) rename init.gentoo => init-scripts/init.gentoo (100%) rename init.solaris11 => init-scripts/init.solaris11 (100%) rename init.systemd => init-scripts/init.systemd (100%) rename init.ubuntu => init-scripts/init.ubuntu (100%) diff --git a/CHANGES.md b/CHANGES.md index 47309da4..2ba4c432 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -74,6 +74,7 @@ * Add IMDb Popular to Add Show page * Add version to anime renaming pattern * Add Code Climate configuration files +* Change to move init-scripts to single folder [develop changelog] Enable Alpha Ratio again now that the secure login page over https is fixed diff --git a/init.debian b/init-scripts/init.debian similarity index 100% rename from init.debian rename to init-scripts/init.debian diff --git a/init.fedora b/init-scripts/init.fedora similarity index 100% rename from init.fedora rename to init-scripts/init.fedora diff --git a/init.freebsd b/init-scripts/init.freebsd similarity index 100% rename from init.freebsd rename to init-scripts/init.freebsd diff --git a/init.gentoo b/init-scripts/init.gentoo similarity index 100% rename from init.gentoo rename to init-scripts/init.gentoo diff --git a/init.solaris11 b/init-scripts/init.solaris11 similarity index 100% rename from init.solaris11 rename to init-scripts/init.solaris11 diff --git a/init.systemd b/init-scripts/init.systemd similarity index 100% rename from init.systemd rename to init-scripts/init.systemd diff --git a/init.ubuntu b/init-scripts/init.ubuntu similarity index 100% rename from init.ubuntu rename to init-scripts/init.ubuntu From 6b129c9eee60e658fe6a21f4455a8d43ef56a578 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 19 Nov 2015 12:40:31 +0800 Subject: [PATCH 2/2] Change sickbeard variables to sickgear variables in init-scripts --- CHANGES.md | 1 + init-scripts/init.debian | 70 ++++++++++++++--------------- init-scripts/init.fedora | 24 +++++----- init-scripts/init.freebsd | 88 ++++++++++++++++++------------------- init-scripts/init.gentoo | 34 +++++++------- init-scripts/init.solaris11 | 62 +++++++++++++------------- init-scripts/init.systemd | 32 +++++++------- init-scripts/init.ubuntu | 60 ++++++++++++------------- 8 files changed, 186 insertions(+), 185 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2ba4c432..4f413467 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -75,6 +75,7 @@ * Add version to anime renaming pattern * Add Code Climate configuration files * Change to move init-scripts to single folder +* Change sickbeard variables to sickgear variables in init-scripts [develop changelog] Enable Alpha Ratio again now that the secure login page over https is fixed diff --git a/init-scripts/init.debian b/init-scripts/init.debian index 4d625fd7..deeda438 100755 --- a/init-scripts/init.debian +++ b/init-scripts/init.debian @@ -1,15 +1,15 @@ #!/bin/sh # ### BEGIN INIT INFO -# Provides: sickbeard +# Provides: sickgear # Required-Start: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs # Should-Start: $NetworkManager # Should-Stop: $NetworkManager # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: starts instance of SickBeard -# Description: starts instance of SickBeard using start-stop-daemon +# Short-Description: starts instance of SickGear +# Description: starts instance of SickGear using start-stop-daemon ### END INIT INFO # Load the VERBOSE setting and other rcS variables @@ -19,57 +19,57 @@ # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions -# Source SickBeard configuration -if [ -f /etc/default/sickbeard ]; then - . /etc/default/sickbeard +# Source SickGear configuration +if [ -f /etc/default/sickgear ]; then + . /etc/default/sickgear else - [ "${VERBOSE}" != no ] && echo "/etc/default/sickbeard not found. Using default settings."; + [ "${VERBOSE}" != no ] && echo "/etc/default/sickgear not found. Using default settings."; fi ## Don't set -e ## Don't edit this file! -## Edit user configuation in /etc/default/sickbeard to change +## Edit user configuation in /etc/default/sickgear to change ## -## SB_USER= #$RUN_AS, username to run sickbeard under, the default is sickbeard -## SB_GROUP= #$RUN_GROUP, group to run sickbeard under, the default is sickbeard -## SB_HOME= #$APP_PATH, the location of SickBeard.py, the default is /opt/sickbeard -## SB_DATA= #$DATA_DIR, the location of sickbeard.db, cache, logs, the default is /opt/sickbeard -## SB_PIDFILE= #$PID_FILE, the location of sickbeard.pid, the default is /var/run/sickbeard/sickbeard.pid +## SG_USER= #$RUN_AS, username to run sickgear under, the default is sickgear +## SG_GROUP= #$RUN_GROUP, group to run sickgear under, the default is sickgear +## SG_HOME= #$APP_PATH, the location of SickBeard.py, the default is /opt/sickgear +## SG_DATA= #$DATA_DIR, the location of sickbeard.db, cache, logs, the default is /opt/sickgear +## SG_PIDFILE= #$PID_FILE, the location of sickgear.pid, the default is /var/run/sickgear/sickgear.pid ## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python -## SB_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for sickbeard, i.e. " --config=/home/sickbeard/config.ini" +## SG_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for sickgear, i.e. " --config=/home/sickgear/config.ini" ## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users" ## ## EXAMPLE if want to run as different user -## add SB_USER=username to /etc/default/sickbeard -## otherwise default sickbeard is used +## add SG_USER=username to /etc/default/sickgear +## otherwise default sickgear is used # Script name NAME=$(basename "$0") # App name -DESC=SickBeard +DESC=SickGear ## The defaults -# Run as username -RUN_AS=${SB_USER-sickbeard} +# Run as username +RUN_AS=${SG_USER-sickgear} # Run as group -RUN_GROUP=${SB_GROUP-sickbeard} +RUN_GROUP=${SG_GROUP-sickgear} -# Path to app SB_HOME=path_to_app_SickBeard.py -APP_PATH=${SB_HOME-/opt/sickbeard} +# Path to app SG_HOME=path_to_app_SickBeard.py +APP_PATH=${SG_HOME-/opt/sickgear} # Data directory where sickbeard.db, cache and logs are stored -DATA_DIR=${SB_DATA-/opt/sickbeard} +DATA_DIR=${SG_DATA-/opt/sickgear} # Path to store PID file -PID_FILE=${SB_PIDFILE-/var/run/sickbeard/sickbeard.pid} +PID_FILE=${SG_PIDFILE-/var/run/sickgear/sickgear.pid} # path to python bin DAEMON=${PYTHON_BIN-/usr/bin/python} -# Extra daemon option like: SB_OPTS=" --config=/home/sickbeard/config.ini" -EXTRA_DAEMON_OPTS=${SB_OPTS-} +# Extra daemon option like: SG_OPTS=" --config=/home/sickgear/config.ini" +EXTRA_DAEMON_OPTS=${SG_OPTS-} # Extra start-stop-daemon option like START_OPTS=" --group=users" EXTRA_SSD_OPTS=${SSD_OPTS-} @@ -82,7 +82,7 @@ DAEMON_OPTS=" SickBeard.py -q --daemon --nolaunch --pidfile=${PID_FILE} --datadi test -x $DAEMON || exit 0 -# Create PID directory if not exist and ensure the SickBeard user can write to it +# Create PID directory if not exist and ensure the SickGear user can write to it if [ ! -d $PID_PATH ]; then mkdir -p $PID_PATH chown $RUN_AS $PID_PATH @@ -101,9 +101,9 @@ if [ -e $PID_FILE ]; then fi fi -start_sickbeard() { +start_sickgear() { [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - start-stop-daemon -d $APP_PATH -c $RUN_AS --group=${RUN_GROUP} $EXTRA_SSD_OPTS --start --quiet --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS + start-stop-daemon -d $APP_PATH -c $RUN_AS --group=${RUN_GROUP} $EXTRA_SSD_OPTS --start --quiet --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS RETVAL="$?" case "${RETVAL}" in # Service was started or was running already @@ -115,7 +115,7 @@ start_sickbeard() { return 0 } -stop_sickbeard() { +stop_sickgear() { [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --pidfile $PID_FILE --quiet --retry TERM/30/KILL/5 RETVAL="$?" @@ -127,23 +127,23 @@ stop_sickbeard() { esac [ "${RETVAL}" = 2 ] && return 2 [ -f "${PID_FILE}" ] && rm -f ${PID_FILE} - return 0 + return 0 } case "$1" in start) - start_sickbeard + start_sickgear exit $? ;; stop) - stop_sickbeard + stop_sickgear exit $? ;; restart|force-reload) - stop_sickbeard + stop_sickgear sleep 2 - start_sickbeard + start_sickgear return $? ;; status) diff --git a/init-scripts/init.fedora b/init-scripts/init.fedora index a213a1d7..89488a66 100755 --- a/init-scripts/init.fedora +++ b/init-scripts/init.fedora @@ -1,7 +1,7 @@ #!/bin/sh # ### BEGIN INIT INFO -# Provides: sickbeard +# Provides: sickgear # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 @@ -13,27 +13,27 @@ # Source function library. . /etc/init.d/functions -# Source SickBeard configuration -if [ -f /etc/sysconfig/sickbeard ]; then - . /etc/sysconfig/sickbeard +# Source SickGear configuration +if [ -f /etc/sysconfig/sickgear ]; then + . /etc/sysconfig/sickgear fi -prog=sickbeard +prog=sickgear lockfile=/var/lock/subsys/$prog -## Edit user configuation in /etc/sysconfig/sickbeard to change +## Edit user configuation in /etc/sysconfig/sickgear to change ## the defaults -username=${SB_USER-sickbeard} -homedir=${SB_HOME-/opt/sickbeard} -datadir=${SB_DATA-/opt/sickbeard} -pidfile=${SB_PIDFILE-/var/run/sickbeard/sickbeard.pid} -nice=${SB_NICE-} +username=${SG_USER-sickgear} +homedir=${SG_HOME-/opt/sickgear} +datadir=${SG_DATA-/opt/sickgear} +pidfile=${SG_PIDFILE-/var/run/sickgear/sickgear.pid} +nice=${SG_NICE-} ## pidpath=`dirname ${pidfile}` options=" --daemon --nolaunch --pidfile=${pidfile} --datadir=${datadir}" -# create PID directory if not exist and ensure the SickBeard user can write to it +# create PID directory if not exist and ensure the SickGear user can write to it if [ ! -d $pidpath ]; then mkdir -p $pidpath chown $username $pidpath diff --git a/init-scripts/init.freebsd b/init-scripts/init.freebsd index 435fc05f..2a2374ac 100755 --- a/init-scripts/init.freebsd +++ b/init-scripts/init.freebsd @@ -1,66 +1,66 @@ #!/bin/sh # -# PROVIDE: sickbeard +# PROVIDE: sickgear # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # -# sickbeard_enable (bool): Set to NO by default. +# sickgear_enable (bool): Set to NO by default. # Set it to YES to enable it. -# sickbeard_user: The user account SickGear daemon runs as what +# sickgear_user: The user account SickGear daemon runs as what # you want it to be. It uses '_sabnzbd' user by # default. Do not sets it as empty or it will run # as root. -# sickbeard_dir: Directory where SickGear lives. -# Default: /usr/local/sickbeard -# sickbeard_chdir: Change to this directory before running SickGear. -# Default is same as sickbeard_dir. -# sickbeard_datadir: Data directory for Sick Beard (DB, Logs, config) -# Default is same as sickbeard_chdir -# sickbeard_pid: The name of the pidfile to create. -# Default is sickbeard.pid in sickbeard_dir. -# sickbeard_host: The hostname or IP SickGear is listening on +# sickgear_dir: Directory where SickGear lives. +# Default: /usr/local/sickgear +# sickgear_chdir: Change to this directory before running SickGear. +# Default is same as sickgear_dir. +# sickgear_datadir: Data directory for Sick Beard (DB, Logs, config) +# Default is same as sickgear_chdir +# sickgear_pid: The name of the pidfile to create. +# Default is sickgear.pid in sickgear_dir. +# sickgear_host: The hostname or IP SickGear is listening on # Default is 127.0.0.1 -# sickbeard_port: The port SickGear is listening on +# sickgear_port: The port SickGear is listening on # Default is 8081 -# sickbeard_web_user: Username to authenticate to the SickGear web interface +# sickgear_web_user: Username to authenticate to the SickGear web interface # Default is an empty string (no username) -# sickbeard_web_password: Password to authenticate to the SickGear web interface +# sickgear_web_password: Password to authenticate to the SickGear web interface # Default is an empty string (no password) -# sickbeard_webroot: Set to value of web_root in config (for proxies etc) +# sickgear_webroot: Set to value of web_root in config (for proxies etc) # Default is an empty string (if set must start with a "/") PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" . /etc/rc.subr -name="sickbeard" +name="sickgear" rcvar=${name}_enable load_rc_config ${name} -: ${sickbeard_enable:="NO"} -: ${sickbeard_user:="_sabnzbd"} -: ${sickbeard_dir:="/usr/local/sickbeard"} -: ${sickbeard_chdir:="${sickbeard_dir}"} -: ${sickbeard_datadir:="${sickbeard_chdir}"} -: ${sickbeard_pid:="${sickbeard_dir}/sickbeard.pid"} -: ${sickbeard_host:="127.0.0.1"} -: ${sickbeard_port:="8081"} -: ${sickbeard_web_user:=""} -: ${sickbeard_web_password:=""} -: ${sickbeard_webroot:=""} +: ${sickgear_enable:="NO"} +: ${sickgear_user:="_sabnzbd"} +: ${sickgear_dir:="/usr/local/sickgear"} +: ${sickgear_chdir:="${sickgear_dir}"} +: ${sickgear_datadir:="${sickgear_chdir}"} +: ${sickgear_pid:="${sickgear_dir}/sickgear.pid"} +: ${sickgear_host:="127.0.0.1"} +: ${sickgear_port:="8081"} +: ${sickgear_web_user:=""} +: ${sickgear_web_password:=""} +: ${sickgear_webroot:=""} status_cmd="${name}_status" stop_cmd="${name}_stop" command="/usr/sbin/daemon" -command_args="-f -p ${sickbeard_pid} python ${sickbeard_dir}/SickBeard.py --quiet --nolaunch" +command_args="-f -p ${sickgear_pid} python ${sickgear_dir}/SickBeard.py --quiet --nolaunch" # Add datadir to the command if set -[ ! -z "${sickbeard_datadir}" ] && \ - command_args="${command_args} --datadir ${sickbeard_datadir}" +[ ! -z "${sickgear_datadir}" ] && \ + command_args="${command_args} --datadir ${sickgear_datadir}" # Ensure user is root when running this script. if [ `id -u` != "0" ]; then @@ -68,31 +68,31 @@ if [ `id -u` != "0" ]; then exit 1 fi -verify_sickbeard_pid() { +verify_sickgear_pid() { # Make sure the pid corresponds to the SickGear process. - pid=`cat ${sickbeard_pid} 2>/dev/null` - ps -p ${pid} 2>/dev/null | grep -q "python ${sickbeard_dir}/SickBeard.py" + pid=`cat ${sickgear_pid} 2>/dev/null` + ps -p ${pid} 2>/dev/null | grep -q "python ${sickgear_dir}/SickBeard.py" return $? } # Try to stop SickGear cleanly by calling shutdown over http. -sickbeard_stop() { +sickgear_stop() { echo "Stopping $name" - verify_sickbeard_pid - sickbeard_url="${sickbeard_host}:${sickbeard_port}" - [ ! -z "${sickbeard_web_user}" ] && \ - sickbeard_url="${sickbeard_web_user}:${sickbeard_web_password}@${sickbeard_url}" - [ ! -z "${sickbeard_webroot}" ] && \ - sickbeard_url="${sickbeard_url}${sickbeard_webroot}" - fetch -o - -q "http://${sickbeard_url}/home/shutdown/?pid=${pid}" >/dev/null + verify_sickgear_pid + sickgear_url="${sickgear_host}:${sickgear_port}" + [ ! -z "${sickgear_web_user}" ] && \ + sickgear_url="${sickgear_web_user}:${sickgear_web_password}@${sickgear_url}" + [ ! -z "${sickgear_webroot}" ] && \ + sickgear_url="${sickgear_url}${sickgear_webroot}" + fetch -o - -q "http://${sickgear_url}/home/shutdown/?pid=${pid}" >/dev/null if [ -n "${pid}" ]; then wait_for_pids ${pid} echo "Stopped" fi } -sickbeard_status() { - verify_sickbeard_pid && echo "$name is running as ${pid}" || echo "$name is not running" +sickgear_status() { + verify_sickgear_pid && echo "$name is running as ${pid}" || echo "$name is not running" } run_rc_command "$1" diff --git a/init-scripts/init.gentoo b/init-scripts/init.gentoo index 9791edd6..931b04df 100755 --- a/init-scripts/init.gentoo +++ b/init-scripts/init.gentoo @@ -9,15 +9,15 @@ # You will need to create a configuration file in order for this script # to work properly. Please create /etc/conf.d/sickbeard with the following: # -# SICKBEARD_USER= -# SICKBEARD_GROUP= -# SICKBEARD_DIR= +# SICKGEAR_USER= +# SICKGEAR_GROUP= +# SICKGEAR_DIR= # PATH_TO_PYTHON_2=/usr/bin/python2 -# SICKBEARD_DATADIR= -# SICKBEARD_CONFDIR= +# SICKGEAR_DATADIR= +# SICKGEAR_CONFDIR= # -RUNDIR=/var/run/sickbeard +RUNDIR=/var/run/sickgear depend() { need net @@ -30,32 +30,32 @@ get_pidfile() { -e 's/[[:space:]]*$//' \ -e 's/^[[:space:]]*//' \ -e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \ - < ${SICKBEARD_CONFDIR}/config.ini \ + < ${SICKGEAR_CONFDIR}/config.ini \ | sed -n -e "/^\[General\]/,/^\s*\[/{/^[^;].*\=.*/p;}"` - echo "${RUNDIR}/sickbeard-${web_port}.pid" + echo "${RUNDIR}/sickgear-${web_port}.pid" } start() { - ebegin "Starting Sickbeard" + ebegin "Starting SickGear" - checkpath -q -d -o ${SICKBEARD_USER}:${SICKBEARD_GROUP} -m 0770 "${RUNDIR}" + checkpath -q -d -o ${SICKGEAR_USER}:${SICKGEAR_GROUP} -m 0770 "${RUNDIR}" start-stop-daemon \ --quiet \ --start \ - --user ${SICKBEARD_USER} \ - --group ${SICKBEARD_GROUP} \ - --name sickbeard \ + --user ${SICKGEAR_USER} \ + --group ${SICKGEAR_GROUP} \ + --name sickgear \ --background \ --pidfile $(get_pidfile) \ --exec ${PATH_TO_PYTHON_2} \ -- \ - ${SICKBEARD_DIR}/SickBeard.py \ + ${SICKGEAR_DIR}/SickBeard.py \ -d \ --pidfile $(get_pidfile) \ - --config ${SICKBEARD_CONFDIR}/config.ini \ - --datadir ${SICKBEARD_DATADIR} + --config ${SICKGEAR_CONFDIR}/config.ini \ + --datadir ${SICKGEAR_DATADIR} eend $? } @@ -74,5 +74,5 @@ stop() { local pidfile=$(get_pidfile) local rc - ebegin "Stopping Sickbeard" + ebegin "Stopping SickGear" } diff --git a/init-scripts/init.solaris11 b/init-scripts/init.solaris11 index 9c512a3d..8f566e4a 100755 --- a/init-scripts/init.solaris11 +++ b/init-scripts/init.solaris11 @@ -1,35 +1,35 @@ - - - + + + - + - + @@ -39,7 +39,7 @@ type='service'> - + @@ -49,7 +49,7 @@ type='service'> - + @@ -59,37 +59,37 @@ type='service'> - - + + - + - + - + - + - + - + diff --git a/init-scripts/init.systemd b/init-scripts/init.systemd index 8ce16962..109fca19 100755 --- a/init-scripts/init.systemd +++ b/init-scripts/init.systemd @@ -4,54 +4,54 @@ # # - Option names (e.g. ExecStart=, Type=) are case-sensitive) # -# - Adjust User= and Group= to the user/group you want Sickbeard to run as. +# - Adjust User= and Group= to the user/group you want SickGear to run as. # # - Optional adjust EnvironmentFile= path to configuration file # Can ONLY be used for configuring extra options used in ExecStart. # Putting a minus (-) in front of file means no error warning if the file doesn't exist # -# - Adjust ExecStart= to point to your python and SickBeard executables. +# - Adjust ExecStart= to point to your python and SickGear executables. # The FIRST token of the command line must be an ABSOLUTE FILE NAME, # then followed by arguments for the process. # If no --datadir is given, data is stored in same dir as SickBeard.py # Arguments can also be set in EnvironmentFile (except python) # -# - WantedBy= specifies which target (i.e. runlevel) to start Sickbeard for. +# - WantedBy= specifies which target (i.e. runlevel) to start SickGear for. # multi-user.target equates to runlevel 3 (multi-user text mode) # graphical.target equates to runlevel 5 (multi-user X11 graphical mode) # -### Example Using SickBeard as daemon with pid file +### Example Using SickGear as daemon with pid file # Type=forking -# PIDFile=/var/run/sickbeard/sickbeard.pid -# ExecStart=/usr/bin/python /opt/sickbeard/SickBeard.py -q --daemon --nolaunch --pidfile=/var/run/sickbeard/sickbeard.pid --datadir=/opt/sickbeard +# PIDFile=/var/run/sickgear/sickgear.pid +# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --pidfile=/var/run/sickgear/sickgear.pid --datadir=/opt/sickgear -## Example Using SickBeard as daemon without pid file +## Example Using SickGear as daemon without pid file # Type=forking # GuessMainPID=no -# ExecStart=/usr/bin/python /opt/sickbeard/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickbeard +# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickgear ### Example Using simple # Type=simple -# ExecStart=/usr/bin/python /opt/sickbeard/SickBeard.py -q --nolaunch +# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --nolaunch -### Example Using simple with EnvironmentFile where SB_DATA=/home/sickbeard/.sickbeard in /etc/sickbeard.conf +### Example Using simple with EnvironmentFile where SB_DATA=/home/sickgear/.sickgear in /etc/sickgear.conf # Type=simple -# EnvironmentFile=/etc/sickbeard.conf -# ExecStart=/usr/bin/python /opt/sickbeard/SickBeard.py -q --nolaunch --datadir=${SB_DATA} +# EnvironmentFile=/etc/sickgear.conf +# ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --nolaunch --datadir=${SB_DATA} ### Configuration [Unit] -Description=SickBeard Daemon +Description=SickGear Daemon [Service] -User=sickbeard -Group=sickbeard +User=sickgear +Group=sickgear Type=forking GuessMainPID=no -ExecStart=/usr/bin/python /opt/sickbeard/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickbeard +ExecStart=/usr/bin/python /opt/sickgear/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickgear [Install] WantedBy=multi-user.target diff --git a/init-scripts/init.ubuntu b/init-scripts/init.ubuntu index 17bdb254..3fae5d7b 100755 --- a/init-scripts/init.ubuntu +++ b/init-scripts/init.ubuntu @@ -1,7 +1,7 @@ #!/bin/sh # ### BEGIN INIT INFO -# Provides: sickbeard +# Provides: sickgear # Required-Start: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs # Should-Start: $NetworkManager @@ -12,55 +12,55 @@ # Description: starts instance of SickGear using start-stop-daemon ### END INIT INFO -# Source SickBeard configuration -if [ -f /etc/default/sickbeard ]; then - . /etc/default/sickbeard +# Source SickGear configuration +if [ -f /etc/default/sickgear ]; then + . /etc/default/sickgear else - echo "/etc/default/sickbeard not found using default settings."; + echo "/etc/default/sickgear not found using default settings."; fi # Source init functions . /lib/lsb/init-functions # Script name -NAME=sickbeard +NAME=sickgear # App name -DESC=SickBeard +DESC=SickGear ## Don't edit this file -## Edit user configuation in /etc/default/sickbeard to change +## Edit user configuation in /etc/default/sickgear to change ## -## SB_USER= #$RUN_AS, username to run sickbeard under, the default is sickbeard -## SB_HOME= #$APP_PATH, the location of SickBeard.py, the default is /opt/sickbeard -## SB_DATA= #$DATA_DIR, the location of sickbeard.db, cache, logs, the default is /opt/sickbeard -## SB_PIDFILE= #$PID_FILE, the location of sickbeard.pid, the default is /var/run/sickbeard/sickbeard.pid +## SG_USER= #$RUN_AS, username to run sickgear under, the default is sickgear +## SG_HOME= #$APP_PATH, the location of SickBeard.py, the default is /opt/sickgear +## SG_DATA= #$DATA_DIR, the location of sickbeard.db, cache, logs, the default is /opt/sickgear +## SG_PIDFILE= #$PID_FILE, the location of sickgear.pid, the default is /var/run/sickgear/sickgear.pid ## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python -## SB_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for sickbeard, i.e. " --config=/home/sickbeard/config.ini" +## SG_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for sickgear, i.e. " --config=/home/sickgear/config.ini" ## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users" ## ## EXAMPLE if want to run as different user -## add SB_USER=username to /etc/default/sickbeard -## otherwise default sickbeard is used +## add SG_USER=username to /etc/default/sickgear +## otherwise default sickgear is used ## The defaults -# Run as username -RUN_AS=${SB_USER-sickbeard} +# Run as username +RUN_AS=${SG_USER-sickgear} -# Path to app SB_HOME=path_to_app_SickBeard.py -APP_PATH=${SB_HOME-/opt/sickbeard} +# Path to app SG_HOME=path_to_app_SickBeard.py +APP_PATH=${SG_HOME-/opt/sickgear} # Data directory where sickbeard.db, cache and logs are stored -DATA_DIR=${SB_DATA-/opt/sickbeard} +DATA_DIR=${SG_DATA-/opt/sickgear} # Path to store PID file -PID_FILE=${SB_PIDFILE-/var/run/sickbeard/sickbeard.pid} +PID_FILE=${SG_PIDFILE-/var/run/sickgear/sickgear.pid} # path to python bin DAEMON=${PYTHON_BIN-/usr/bin/python} -# Extra daemon option like: SB_OPTS=" --config=/home/sickbeard/config.ini" -EXTRA_DAEMON_OPTS=${SB_OPTS-} +# Extra daemon option like: SG_OPTS=" --config=/home/sickgear/config.ini" +EXTRA_DAEMON_OPTS=${SG_OPTS-} # Extra start-stop-daemon option like START_OPTS=" --group=users" EXTRA_SSD_OPTS=${SSD_OPTS-} @@ -75,7 +75,7 @@ test -x $DAEMON || exit 0 set -e -# Create PID directory if not exist and ensure the SickBeard user can write to it +# Create PID directory if not exist and ensure the SickGear user can write to it if [ ! -d $PID_PATH ]; then mkdir -p $PID_PATH chown $RUN_AS $PID_PATH @@ -94,28 +94,28 @@ if [ -e $PID_FILE ]; then fi fi -start_sickbeard() { +start_sickgear() { echo "Starting $DESC" start-stop-daemon -d $APP_PATH -c $RUN_AS $EXTRA_SSD_OPTS --start --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS } -stop_sickbeard() { +stop_sickgear() { echo "Stopping $DESC" start-stop-daemon --stop --pidfile $PID_FILE --retry 15 } case "$1" in start) - start_sickbeard + start_sickgear ;; stop) - stop_sickbeard + stop_sickgear ;; restart|force-reload) - stop_sickbeard + stop_sickgear sleep 2 - start_sickbeard + start_sickgear ;; status) status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC"