mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
0d9fbc1ad7
This version of SickBeard uses both TVDB and TVRage to search and gather it's series data from allowing you to now have access to and download shows that you couldn't before because of being locked into only what TheTVDB had to offer. Also this edition is based off the code we used in our XEM editon so it does come with scene numbering support as well as all the other features our XEM edition has to offer. Please before using this with your existing database (sickbeard.db) please make a backup copy of it and delete any other database files such as cache.db and failed.db if present, we HIGHLY recommend starting out with no database files at all to make this a fresh start but the choice is at your own risk! Enjoy!
92 lines
2.9 KiB
Bash
92 lines
2.9 KiB
Bash
#!/bin/sh
|
|
#
|
|
# PROVIDE: sickbeard
|
|
# 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.
|
|
# Set it to YES to enable it.
|
|
# sickbeard_user: The user account Sick Beard 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 Sick Beard lives.
|
|
# Default: /usr/local/sickbeard
|
|
# sickbeard_chdir: Change to this directory before running Sick Beard.
|
|
# Default is same as sickbeard_dir.
|
|
# sickbeard_pid: The name of the pidfile to create.
|
|
# Default is sickbeard.pid in sickbeard_dir.
|
|
# sickbeard_host: The hostname or IP Sick Beard is listening on
|
|
# Default is 127.0.0.1
|
|
# sickbeard_port: The port Sick Beard is listening on
|
|
# Default is 8081
|
|
# sickbeard_web_user: Username to authenticate to the Sick Beard web interface
|
|
# Default is an empty string (no username)
|
|
# sickbeard_web_password: Password to authenticate to the Sick Beard web interface
|
|
# Default is an empty string (no password)
|
|
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="sickbeard"
|
|
rcvar=${name}_enable
|
|
|
|
load_rc_config ${name}
|
|
|
|
: ${sickbeard_enable:="NO"}
|
|
: ${sickbeard_user:="_sabnzbd"}
|
|
: ${sickbeard_dir:="/usr/local/sickbeard"}
|
|
: ${sickbeard_chdir:="${sickbeard_dir}"}
|
|
: ${sickbeard_pid:="${sickbeard_dir}/sickbeard.pid"}
|
|
: ${sickbeard_host:="127.0.0.1"}
|
|
: ${sickbeard_port:="8081"}
|
|
: ${sickbeard_web_user:=""}
|
|
: ${sickbeard_web_password:=""}
|
|
|
|
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown Sick Beard.
|
|
|
|
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"
|
|
|
|
# Check for wget and refuse to start without it.
|
|
if [ ! -x "${WGET}" ]; then
|
|
warn "Sickbeard not started: You need wget to safely shut down Sick Beard."
|
|
exit 1
|
|
fi
|
|
|
|
# Ensure user is root when running this script.
|
|
if [ `id -u` != "0" ]; then
|
|
echo "Oops, you should be root before running this!"
|
|
exit 1
|
|
fi
|
|
|
|
verify_sickbeard_pid() {
|
|
# Make sure the pid corresponds to the Sick Beard process.
|
|
pid=`cat ${sickbeard_pid} 2>/dev/null`
|
|
ps -p ${pid} 2>/dev/null | grep -q "python ${sickbeard_dir}/SickBeard.py"
|
|
return $?
|
|
}
|
|
|
|
# Try to stop Sick Beard cleanly by calling shutdown over http.
|
|
sickbeard_stop() {
|
|
echo "Stopping $name"
|
|
verify_sickbeard_pid
|
|
${WGET} -O - -q --user=${sickbeard_web_user} --password=${sickbeard_web_password} "http://${sickbeard_host}:${sickbeard_port}/home/shutdown/" >/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"
|
|
}
|
|
|
|
run_rc_command "$1"
|
|
|