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
-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"