User rc.d scripts not starting

I've installed sabnzbdplus via pkg_add and it's working well, but it refuses to launch at system boot. The script works fine when called manually:

/usr/local/etc/rc.d/sabnzbd start

but the
Code:
sabnzbd_enable="YES"
line in my /etc/rc.conf doesn't seem to do anything. The /usr/local/etc/rc.d/ directory and all of its scripts are chmodded to 755 and owned by root:wheel, so it's not a permissions issue.

I've set up debug output in rc.conf, and it doesn't even seem to be trying to run the scripts in /usr/local/etc/rc.d/.

Is there another step that I'm missing? I've installed sabnzbdplus on FreeBSD 8.x using ports before and it worked without issue. Not sure why installing from packages on 9.0 should be any different.
 
What does [cmd=]/usr/local/etc/rc.d/sabnzbd rcvar[/cmd] say, and what does /usr/local/etc/rc.d/sabnzbd (the script itself) say that it wants to see in rc.conf?

If the rcvar doesn't register anything, chances are that your entry in rc.conf is not the right one, and/or that it has a typo.
 
Here's the output from rcvar:

Code:
# sabnzbd
#
sabnzbd_enable="YES"
#   (default: "")

and here's the section in the startup script that references rc.conf:

Code:
name="sabnzbd"
rcvar=${name}_enable

load_rc_config ${name}

: ${sabnzbd_enable:="NO"}
: ${sabnzbd_user:="_sabnzbd"}
: ${sabnzbd_group:="_sabnzbd"}
: ${sabnzbd_conf_dir:="/usr/local/sabnzbd"}

required_dirs=${sabnzbd_conf_dir}

start_cmd="${name}_start"
#start_postcmd="${name}_poststart"
status_cmd="${name}_status"
stop_cmd="${name}_stop"
start_precmd=sabnzbd_check_dir

Also, when manually starting the service using the script, it seems to read these values from the conf file without any issue. Seems like everything here is sane; am I missing something?
 
Could this be an older version of the port? I'm looking at an interesting port commit message from 14 Jan 2012 (the second commit message on news/sabnzbdplus), which states:

In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not
, to prepare for the demise of set_rcvar().

Interestingly, in an up-to-date ports tree, /usr/ports/news/sabnzbdplus/files/sabnzbd.in sets a specific

Code:
name="sabnzbd"
rcvar=sabnzbd_enable

whereas your rc.d script still shows

Code:
name="sabnzbd"
rcvar=${name}_enable

Can you update your ports tree to the latest and greatest, reinstall this port, and try again?
 
Ok, I've updated sabnzbd from ports and it's at v0.6.15. The rc.d file has the syntax you mention, so we should be good, except for the fact that it's still not being run at startup.

Is there a way to trace which rc.d scripts are being run at startup? I'm not convinced that the rc process is actually trying to start this script, and even with RC_DEBUG set to "YES", I still wasn't given enough information to determine that.

Any ideas?
 
[cmd=]dmesg -a[/cmd] should be showing some 'Starting ...' lines near the end. Using [cmd=]rcorder /etc/rc.d/* /usr/local/etc/rc.d/*[/cmd] will give you the exact order in which the scripts are started (if they have "YES" set) at boot time.

You can also add
Code:
set -xv
exec 1>/tmp/output.txt 2>&1
to the sabnzbd rc.d script (right below the hashbang) and carefully inspect /tmp/output.txt after a reboot.

In case you can't get it to start, you can also force-start sabnzbd by putting [cmd=]/usr/local/etc/rc.d/sabnzbd start[/cmd] in /etc/rc.local or in root's crontab (crontab -u as root) with the @reboot time.
 
Ahh, much better. It looks like sabnzbd is trying to start before the network is available:

Code:
rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
/usr/local/etc/rc.d/sabnzbd
/etc/rc.d/sysctl
/etc/rc.d/hostid
/etc/rc.d/zvol
/etc/rc.d/dumpon
/etc/rc.d/ddb
/etc/rc.d/initrandom
/etc/rc.d/geli
/etc/rc.d/gbde
/etc/rc.d/encswap
/etc/rc.d/ccd
/etc/rc.d/swap1
/etc/rc.d/fsck
/etc/rc.d/root
/etc/rc.d/mdconfig
/etc/rc.d/hostid_save
/etc/rc.d/mountcritlocal
/etc/rc.d/zfs
/etc/rc.d/FILESYSTEMS
/etc/rc.d/kld
/etc/rc.d/var
/etc/rc.d/random
/etc/rc.d/adjkerntz
/etc/rc.d/atm1
/etc/rc.d/hostname
/etc/rc.d/ip6addrctl
/etc/rc.d/kldxref
/etc/rc.d/netoptions
/etc/rc.d/sppp
/etc/rc.d/ipfilter
/etc/rc.d/ipnat
/etc/rc.d/ipfs
/etc/rc.d/serial
/etc/rc.d/cleanvar
/etc/rc.d/netif
/etc/rc.d/devd
/etc/rc.d/ipsec
/etc/rc.d/atm2
/etc/rc.d/pfsync
/etc/rc.d/pflog
/etc/rc.d/pf
/etc/rc.d/stf
/etc/rc.d/ppp
/etc/rc.d/faith
/etc/rc.d/routing
/etc/rc.d/mroute6d
/etc/rc.d/nsswitch
/etc/rc.d/rtsold
/etc/rc.d/static_ndp
/etc/rc.d/static_arp
/etc/rc.d/bridge
/etc/rc.d/resolv
...

Can I set a dependency on the sabnzbd script so that it doesn't start until the network service is available? If this is supposed to be in the sabnzbd script itself, why is it not set up like that out of the box?
 
This might work:

Code:
# PROVIDE: sabnzbd
# REQUIRE: NETWORKING
# KEYWORD: shutdown

or

Code:
# PROVIDE: sabnzbd
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: shutdown

See where that lands you in the rcorder.
 
Back
Top