textproc/sphinx rc.d script

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

textproc/sphinx rc.d script

Jay Williams-2
I've installed the Sphinx search daemon (searchd), and noticed that the port
didn't come with a rc.d script. After a good bit of man page reading and
debugging, I was able to get the Sphinx search daemon to behave properly,
namely using the --nodetach and rc_bg options.

To help improve the port, would you want to include this rc.d script, or
something similar? That way if someone wants to setup a Sphinx Search daemon,
they won't have to spend all the time debugging as I did.

--
Jay Williams

#!/bin/ksh
#
# searchd - Sphinxsearch network daemon

daemon="/usr/local/bin/searchd"
daemon_flags="--nodetach"
# daemon_user="deploy"

# force start the daemon in background
rc_bg=YES

. /etc/rc.d/rc.subr

rc_cmd $1

Reply | Threaded
Open this post in threaded view
|

Re: textproc/sphinx rc.d script

Antoine Jacoutot-7
On Tue, Jan 08, 2019 at 04:23:40PM -0600, Jay Williams wrote:
> I've installed the Sphinx search daemon (searchd), and noticed that the port
> didn't come with a rc.d script. After a good bit of man page reading and
> debugging, I was able to get the Sphinx search daemon to behave properly,
> namely using the --nodetach and rc_bg options.
>
> To help improve the port, would you want to include this rc.d script, or
> something similar? That way if someone wants to setup a Sphinx Search daemon,
> they won't have to spend all the time debugging as I did.

I don't know that particular utility but:

> #!/bin/ksh
> #
> # searchd - Sphinxsearch network daemon
>
> daemon="/usr/local/bin/searchd"
> daemon_flags="--nodetach"

Why using --nodetach and then rc_bg=YES ?

> # daemon_user="deploy"
>
> # force start the daemon in background
> rc_bg=YES
>
> . /etc/rc.d/rc.subr
>
> rc_cmd $1
>

--
Antoine

Reply | Threaded
Open this post in threaded view
|

Re: textproc/sphinx rc.d script

Jay Williams-2
>Why using --nodetach and then rc_bg=YES ?

Without the --nodetach flag, the Sphinx daemon doesn't keep listening on the
specified inet ports. (There very well may be a bug in this version of
Sphinx, especially considering it's age, but that's beyond my skills.)

According to the searchd(1) man page, it states:

> --nodetach
>     Do not 'daemonize', or, do not detach into background. Apart debug
>     purposes, this switch is useful when you manage sphinx with upstart
>     init daemon. In this case actual 'daemonizing' will be done by
>     upstart itself, and also all tasks like starting, stopping,
>     reloading the config and respawning on crash will be done by the
>     system, not the sphinx.

Using the --nodetach flag, in combination with rc_bg allows rcctl to
reliability control the searchd process. I tried numerous other
combinations, and they only proved partially successful or failed
completely.

--
Jay Williams

Reply | Threaded
Open this post in threaded view
|

Re: textproc/sphinx rc.d script

Antoine Jacoutot-7
On Wed, Jan 09, 2019 at 09:24:48AM -0600, Jay Williams wrote:

> > Why using --nodetach and then rc_bg=YES ?
>
> Without the --nodetach flag, the Sphinx daemon doesn't keep listening on the
> specified inet ports. (There very well may be a bug in this version of
> Sphinx, especially considering it's age, but that's beyond my skills.)
>
> According to the searchd(1) man page, it states:
>
> > --nodetach
> >     Do not 'daemonize', or, do not detach into background. Apart debug
> >     purposes, this switch is useful when you manage sphinx with upstart
> >     init daemon. In this case actual 'daemonizing' will be done by
> >     upstart itself, and also all tasks like starting, stopping,
> >     reloading the config and respawning on crash will be done by the
> >     system, not the sphinx.
>
> Using the --nodetach flag, in combination with rc_bg allows rcctl to
> reliability control the searchd process. I tried numerous other
> combinations, and they only proved partially successful or failed
> completely.

Ok so that's to workaround a bug.
At the very least it warrants a comment in the rc.d script.

--
Antoine

Reply | Threaded
Open this post in threaded view
|

Re: textproc/sphinx rc.d script

Jay Williams-2
>Ok so that's to workaround a bug.
>At the very least it warrants a comment in the rc.d script.

Perhaps something like this?

#!/bin/ksh
#
# searchd - Sphinxsearch network daemon
#
# Use --nodetach flag in combination with rc_bg to workaround searchd not
# listening on specified network ports

daemon="/usr/local/bin/searchd"
daemon_flags="--nodetach"
# daemon_user="www"

# force start the daemon in background
rc_bg=YES

. /etc/rc.d/rc.subr

rc_cmd $1


--
Jay Williams

Reply | Threaded
Open this post in threaded view
|

Re: textproc/sphinx rc.d script

Antoine Jacoutot-7
On Wed, Jan 09, 2019 at 10:58:27AM -0600, Jay Williams wrote:
> > Ok so that's to workaround a bug.
> > At the very least it warrants a comment in the rc.d script.
>
> Perhaps something like this?

No sorry, that makes no sense.
You didn't explain the issue in the comment.
And also, have a look at ports/infrastructure/templates/rc.template to write
proper rc.d scripts.
You should bump the package as well and provide a proper diff :-)



> #!/bin/ksh
> #
> # searchd - Sphinxsearch network daemon
> #
> # Use --nodetach flag in combination with rc_bg to workaround searchd not #
> listening on specified network ports
>
> daemon="/usr/local/bin/searchd"
> daemon_flags="--nodetach"
> # daemon_user="www"
>
> # force start the daemon in background
> rc_bg=YES
>
> . /etc/rc.d/rc.subr
>
> rc_cmd $1
>
>
> --
> Jay Williams
>

--
Antoine