ports/153357: [patch] sabnzbd rc script fails to kill the process

Damien Fleuriot dam at c-mal.com
Tue Dec 21 21:30:16 UTC 2010

>Number:         153357
>Category:       ports
>Synopsis:       [patch] sabnzbd rc script fails to kill the process
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 21 21:30:15 UTC 2010
>Originator:     Damien Fleuriot
>Release:        7.4
FreeBSD ks306450.kimsufi.com 7.4-PRERELEASE FreeBSD 7.4-PRERELEASE #2: Fri Dec 17 12:26:28 CET 2010     root at ks306450.kimsufi.com:/usr/obj/usr/src/sys/OVH  amd64
The rc script for sabnzbd fails to stop the process.

See, I added a newsgroups host, which was added to sabnzbd.ini

The stop command in the rc.d script uses grep to find what host to send the stop command to (it uses the web interface to shutdown sabnzbd):
host=`grep -E '^host\ =\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9].'`

The problem is, now that I added a newsgroups host, grep matches it too.

Which gives me a $host variable with: "" (interface sabnzbd binds to) AND again "yourdummyngprovider.com" (the newsgroups host) for a grand total of:

In turn, the stop command then tries to curl to:

This will never work.

This problem is repeatable all the time.
I suggest changing the grep command from:
host=`grep -E '^host\ =\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9].'`
host=`grep -E -m1 '^host\ =\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9].'`

-m1 ensures grep stops after 1 match, which is what we want.

Notice this is already done to determine what port the sabnzbd daemon is listening on:
port=`grep -m1 ^port ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9]'`

I have made this change to the rc script on my box and it works fine.


More information about the freebsd-ports-bugs mailing list