mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
added gentoo linux init script
This commit is contained in:
parent
e30ed48fcf
commit
a5d6e0ddea
1 changed files with 78 additions and 0 deletions
78
init.gentoo
Normal file
78
init.gentoo
Normal file
|
@ -0,0 +1,78 @@
|
|||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# History
|
||||
# -------
|
||||
# 1/29 Created Richard Powell richard@powell.ws
|
||||
|
||||
# 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=<user you want sickbeard to run under>
|
||||
# SICKBEARD_GROUP=<group you want sickbeard to run under>
|
||||
# SICKBEARD_DIR=<path to Sickbeard.py>
|
||||
# PATH_TO_PYTHON_2=/usr/bin/python2
|
||||
# SICKBEARD_DATADIR=<directory that contains sickbeard.db file>
|
||||
# SICKBEARD_CONFDIR=<directory that contains Sickbeard's config.ini file>
|
||||
#
|
||||
|
||||
RUNDIR=/var/run/sickbeard
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
get_pidfile() {
|
||||
# Parse the config.ini file for the value of web_port in the General section
|
||||
eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
|
||||
-e 's/;.*$//' \
|
||||
-e 's/[[:space:]]*$//' \
|
||||
-e 's/^[[:space:]]*//' \
|
||||
-e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \
|
||||
< ${SICKBEARD_CONFDIR}/config.ini \
|
||||
| sed -n -e "/^\[General\]/,/^\s*\[/{/^[^;].*\=.*/p;}"`
|
||||
|
||||
echo "${RUNDIR}/sickbeard-${web_port}.pid"
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting Sickbeard"
|
||||
|
||||
checkpath -q -d -o ${SICKBEARD_USER}:${SICKBEARD_GROUP} -m 0770 "${RUNDIR}"
|
||||
|
||||
start-stop-daemon \
|
||||
--quiet \
|
||||
--start \
|
||||
--user ${SICKBEARD_USER} \
|
||||
--group ${SICKBEARD_GROUP} \
|
||||
--name sickbeard \
|
||||
--background \
|
||||
--pidfile $(get_pidfile) \
|
||||
--exec ${PATH_TO_PYTHON_2} \
|
||||
-- \
|
||||
${SICKBEARD_DIR}/SickBeard.py \
|
||||
-d \
|
||||
--pidfile $(get_pidfile) \
|
||||
--config ${SICKBEARD_CONFDIR}/config.ini \
|
||||
--datadir ${SICKBEARD_DATADIR}
|
||||
eend $?
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ "$RC_CMD" == "restart" ]; then
|
||||
local pidfile=$(get_pidfile)
|
||||
while [ -e ${pidfile} ]; do
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
local pidfile=$(get_pidfile)
|
||||
local rc
|
||||
|
||||
ebegin "Stopping Sickbeard"
|
||||
}
|
Loading…
Reference in a new issue