On 2024/01/03 23:06:57 +0000, Mik J <mikyde...@yahoo.fr> wrote:
> Hello,
> 
> I don't understand how the startup/stop script works
> 
> # cat /etc/rc.d/opensearch
> #!/bin/ksh
> 
> daemon="/usr/local/opensearch/bin/opensearch"
> daemon_flags="-d -p /var/run/opensearch/opensearch.pid"
> daemon_user="_opensearch"
> 
> . /etc/rc.d/rc.subr
> 
> pexp="$(/usr/local/bin/javaPathHelper -c opensearch) 
> .*org.opensearch.bootstrap.OpenSearch.*"

  ^^^^

this is the "magic" that powers rcctl check and stop.  The pidfile is
not used by the rc infrastructure (at least for opensearch), the daemon
is found by looking for a process matching that pexp and killing it.

You can check /etc/rc.d/rc.subr to see what exactly happens.

> rc_reload=NO
> 
> rc_pre() {
>         install -d -o _opensearch /var/run/opensearch/
> }
> 
> rc_cmd $1
> 
> 
> I can confirm that the pid I see in /var/run/opensearch/opensearch.pid is the 
> same I see in ps ax | grep opensearch
> 
> However when I want to stop the process
> # /etc/rc.d/opensearch stop
> Nothing happens

What do you mean with 'Nothing happens'?  Here it prints
'opensearch(ok)' and then the daemon is stopped.  (I generally use
rcctl, but the output and behaviour is the same.)

Reply via email to