can't start source from FreeBSD RC

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
SpaceBass
Newbie
Newbie
Posts: 12
Joined: April 22nd, 2012, 10:05 am

can't start source from FreeBSD RC

Post by SpaceBass »

hey all,
I install from source on FreeBSD 13 to make sure I'm on the latest SAB. I also run as a specific user, not root.

I use the rc.d script from the official package with some modifications, specifically the path of python 3.9 and the SABnzbd.py script.

if I run from the command line of the user, it works fine.
If I try the script, it says SABnzbd.py can't be found

this works, as azuser
/usr/local/bin/python3.9 -OO /Users/azuser/sabnzbd-4.0.0/SABnzbd.py -f /usr/local/sabnzbd/sabnzbd.ini

this does not work

Code: Select all

╰─○ sudo service sabnzbd start
Starting sabnzbd.
sh: /Users/azuser/sabnzbd-4.0.0/SABnzbd.py: not found
/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd
╰─○ ls -alh /Users/azuser/sabnzbd-4.0.0/SABnzbd.py
-rwxr-xr-x 1 azuser domain users 63K Apr 28 06:56 /Users/azuser/sabnzbd-4.0.0/SABnzbd.py[/code]

In /etc/rc.conf

Code: Select all

sabnzbd_user="azuser"
sabnzbd_group="mediagroup"
sabnzbd_enable="YES"

rc.d script

Code: Select all

#!/bin/sh
#
# PROVIDE: sabnzbd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sabnzbd_enable (bool):        Set to NO by default.
#                       Set it to YES to enable it.
# sabnzbd_conf_dir:     Directory where sabnzbd configuration
#                       data is stored.
#                       Default: /usr/local/sabnzbd
# sabnzbd_user:         The user account sabnzbd 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.
# sabnzbd_group:        The group account sabnzbd daemon runs as what
#                       you want it to be. It uses '_sabnzbd' group by
#                       default. Do not sets it as empty or it will run
#                       as wheel.
# sabnzbd_pidfile:      Set the location of the sabnzbd pidfile

. /etc/rc.subr

name=sabnzbd
rcvar=sabnzbd_enable
load_rc_config ${name}

: ${sabnzbd_enable:=NO}
: ${sabnzbd_user:=_sabnzbd}
: ${sabnzbd_group:=_sabnzbd}
: ${sabnzbd_conf_dir="/usr/local/sabnzbd"}
: ${sabnzbd_pidfile:="/var/run/sabnzbd/sabnzbd.pid"}

pidfile=${sabnzbd_pidfile}

start_precmd="${name}_prestart"
command_interpreter="/usr/local/bin/python3.9"
#command="/usr/local/bin/SABnzbd.py"
command="/Users/azuser/sabnzbd-4.0.0/SABnzbd.py"
command_args="--daemon -f ${sabnzbd_conf_dir}/sabnzbd.ini --pidfile ${pidfile}"

sabnzbd_prestart()
{
	PATH=${PATH}:/usr/local/bin:/usr/local/sbin
	export LC_CTYPE="en_US.UTF-8"
	for sabdir in ${sabnzbd_conf_dir} ${pidfile%/*}; do
		if [ ! -d "${sabdir}" ]; then
			install -d -o ${sabnzbd_user} -g ${sabnzbd_group} ${sabdir}
		fi
	done
}

run_rc_command "$1"
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: can't start source from FreeBSD RC

Post by jcfp »

Note that the 'not found' in "sh: /Users/azuser/sabnzbd-4.0.0/SABnzbd.py: not found" may also refer to the interpreter listed on the first line of that file, rather than the file itself. Bash has a more specific error message nowadays for that particular problem, but most other shells do not make the distiction.

Try running the service script with the shell's -x option so it prints to the console what it actually ends up doing.
Post Reply