You are not logged in.

#1 2012-05-02 17:01:52

jcortesweb
Member
Registered: 2012-05-01
Posts: 7

[SOLVED] SABnzbd on startup

I am having trouble getting my SABnzbd daemon to work. I have edited the /etc/conf.d/sabnzbd file to look like the following.

# Set the protocol, IP and port
SABNZBD_PROTOCOL="http"
SABNZBD_IP="0.0.0.0"
SABNZBD_PORT="8080"

# Set your default user/group(id), startarguments and your configfile
USE_SYSTEM_IDS="1"
SABNZBD_DIR="/opt/sabnzbd"
#SABNZBD_UID="423"
#SABNZBD_GID="423"
SABNZBD_USER="jcortes"
SABNZBD_GROUP="users"
#SABNZBD_AGROUP="users"     # separate groups by ,
SABNZBD_CONF="/home/jcortes/.sabnzbd.ini/sabnzbd.ini"
SABNZBD_ARGS="-f ${SABNZBD_CONF} -s ${SABNZBD_IP}:${SABNZBD_PORT} -d"

# Put the session keys from Config > General here
SABNZBD_KEY="my27857e7api7b673216564ce20key"
NZB_KEY="myfd645e88c752725api3a4fe877keyc"

# If you use a username and password, change the following variable to
# "user:pass@"
SABNZBD_USPW=""

however it does not start when I reboot. the only way I can get it to run is by typing sabnzbd start in a terminal.

Last edited by jcortesweb (2012-05-02 18:22:26)

Offline

#2 2012-05-02 17:12:53

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Offline

#3 2012-05-02 17:19:17

jcortesweb
Member
Registered: 2012-05-01
Posts: 7

Re: [SOLVED] SABnzbd on startup

I'm aware of how to add daemons to the DAEMON array in rc.conf. There is already a script in the /etc/rc.d/ folder called sabnzbd with the following contents that sabnzbd install provides. My question is why is it not working.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/sabnzbd

PID="$(pgrep -f -u "${SABNZBD_USER}" SABnzbd.py)"

case "${1}" in
  start)
    stat_busy "Starting SABnzbd"

    if [ -f /run/daemons/sabnzbd ]; then
      echo -n "Sabnzbd is already running as a daemon! If you are certain it is not running, remove /run/daemons/sabnzbd."
      stat_fail
    else
      su - "${SABNZBD_USER}" -c "python2 ${SABNZBD_DIR}/SABnzbd.py ${SABNZBD_ARGS}" -s /bin/sh
      if [ "${?}" -gt 0 ]; then
        stat_fail
        exit 1
      else
        add_daemon sabnzbd
        stat_done
      fi
    fi
    ;;
  stop)
    stat_busy "Stopping SABnzbd"

    curl -f "${SABNZBD_PROTOCOL}://${SABNZBD_USPW}${SABNZBD_IP}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${SABNZBD_KEY}" &> /dev/null

    if [ "${?}" -gt 0 ]; then
      stat_fail
      exit 1
    else
      rm_daemon sabnzbd
      stat_done
    fi
    ;;
  force-stop)
    stat_busy "Stopping SABnzbd (forced)"

    [ -n "${PID}" ]; kill "${PID}" &> /dev/null

    if [ "${?}" -gt 0 ]; then
      stat_fail
      exit 1
    else
      [ -f /run/daemons/sabnzbd ]; rm -f /run/daemons/sabnzbd &> /dev/null
      rm_daemon sabnzbd
      stat_done
    fi
    ;;
  restart)
    "${0}" stop
    sleep 1
    "${0}" start
    ;;
  force-restart)
    "${0}" force-stop
    sleep 1
    "${0}" start
    ;;
  status)
    stat_busy "Checking SABnzbd status";
    ck_status sabnzbd
    ;;
  *)
    echo "usage: ${0} {start|stop|restart|force-stop|force-restart|status}"
esac

exit 0

NOTE: I have not changed anything in this script only the config file that is included above in my first post

Last edited by jcortesweb (2012-05-02 17:20:09)

Offline

#4 2012-05-02 18:22:07

jcortesweb
Member
Registered: 2012-05-01
Posts: 7

Re: [SOLVED] SABnzbd on startup

Fresh install fixed it. Only changed the IP in the config to 0.0.0.0 and now it works.

Offline

Board footer

Powered by FluxBB