Private GIT

Skip to main content
Sign in
Snippets Groups Projects
Commit ee3f11ca authored by Nic Wolfe's avatar Nic Wolfe
Browse files

Merge pull request #198 from chuckination/master

Split out data directory in fedora and ubuntu init script
parents 70681a8d 9612affc
No related branches found
No related tags found
No related merge requests found
......@@ -23,12 +23,13 @@ lockfile=/var/lock/subsys/$prog
## the defaults
username=${SB_USER-sickbeard}
homedir=${SB_HOME-/opt/sickbeard}
datadir=${SB_DATA-~/.sickbeard}
pidfile=${SB_PIDFILE-/var/run/sickbeard/sickbeard.pid}
nice=${SB_NICE-}
##
pidpath=`dirname ${pidfile}`
options=" --daemon --pidfile=${pidfile}"
options=" --daemon --pidfile=${pidfile} --datadir=${datadir}"
# create PID directory if not exist and ensure the SickBeard user can write to it
if [ ! -d $pidpath ]; then
......@@ -36,6 +37,11 @@ if [ ! -d $pidpath ]; then
chown $username $pidpath
fi
if [ ! -d $datadir ]; then
mkdir -p $datadir
chown $username $datadir
fi
start() {
# Start daemon.
echo -n $"Starting $prog: "
......
......
......@@ -21,9 +21,6 @@ DAEMON=/usr/bin/python
PID_FILE=/var/run/sickbeard/sickbeard.pid
PID_PATH=`dirname $PID_FILE`
# startup args
DAEMON_OPTS=" SickBeard.py -q --daemon --pidfile=${PID_FILE}"
# script name
NAME=sickbeard
......@@ -33,6 +30,12 @@ DESC=SickBeard
# user
RUN_AS=SICKBEARD_USER
# data directory
DATA_DIR=~/.sickbeard
# startup args
DAEMON_OPTS=" SickBeard.py -q --daemon --pidfile=${PID_FILE} --datadir=${DATA_DIR}"
############### END EDIT ME ##################
test -x $DAEMON || exit 0
......@@ -44,6 +47,12 @@ if [ ! -d $PID_PATH ]; then
chown $RUN_AS $PID_PATH
fi
if [ ! -d $DATA_DIR ]; then
mkdir -p $DATA_DIR
chown $RUN_AS $DATA_DIR
fi
case "$1" in
start)
echo "Starting $DESC"
......@@ -51,13 +60,12 @@ case "$1" in
;;
stop)
echo "Stopping $DESC"
start-stop-daemon --stop --pidfile $PID_FILE
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
;;
restart|force-reload)
echo "Restarting $DESC"
start-stop-daemon --stop --pidfile $PID_FILE
sleep 15
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
;;
*)
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment