Hello Mike, Omar, Stuart,

Thank you for your answers, I've learnt a lot through these.

It seems that my problem was due to the fact that I added this variable in my 
/root/.profile
export JAVA_HOME=/usr/local/jdk-11/

# cat /var/run/rc.d/opensearch
was then showing a double slash
pexp=/usr/local/jdk-11//bin/java .*org.opensearch.bootstrap.OpenSearch.*

By removing the ending slash in the root .profile, the double slash disapeared 
and I have been able to use /etc/rc.d/opensearch stop since then. And also with 
the check parameter which didn't work at the time.

I still have a question Omar, you wrote that the pexp content would be matched
"the daemon is found by looking for a process matching that pexp and killing 
it."

Here I have
pexp="$(/usr/local/bin/javaPathHelper -c opensearch) 
.*org.opensearch.bootstrap.OpenSearch.*"

But in the ps command javaPathHelper doesn't appear so it can't match it
# COLUMNS=1600  ps ax -o command | grep Dopensearch
/usr/local/jdk-11/bin/java -Xshare:auto 
-Dopensearch.networkaddress.cache.ttl=60 
-Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m 
-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true 
-XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true 
-Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 
-Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false 
-Dlog4j2.disable.jmx=true -Djava.locale.providers=SPI,COMPAT -Xms6g -Xmx6g 
-XX:+UseG1GC -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 
-Djava.io.tmpdir=/tmp/opensearch-18321662122565322049 
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data 
-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log 
-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/opensearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
 
-Djava.util.concurrent.ForkJoinPool.common.threadFactory=org.opensearch.secure_sm.SecuredForkJoinWorkerThreadFactory
 -XX:MaxDirectMemorySize=3221225472 
-Dopensearch.path.home=/usr/local/opensearch 
-Dopensearch.path.conf=/etc/opensearch -Dopensearch.distribution.type=tar 
-Dopensearch.bundled_jdk=true -cp 
/usr/local/opensearch/lib/*:/usr/local/share/java//classes//jna.jar:/usr/local/share/java//classes//jna-platform.jar
 org.opensearch.bootstrap.OpenSearch -d -p /var/run/opensearch/opensearch.pid

Thank you




Le jeudi 4 janvier 2024 à 14:36:05 UTC+1, Stuart Henderson 
<stu.li...@spacehopper.org> a écrit : 





On 2024-01-03, Mik J <mikyde...@yahoo.fr> wrote:
> Hello,
>
> I don't understand how the startup/stop script works

It uses the string from pexp (as it was when the daemon was _started_;
changes to the rc script after startup are ignored) with pgrep(1) -xf to
identify the running process (and pkill -xf to actually signal it).

> 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

Show the contents of /var/run/rc.d/opensearch and the output of some
pgrep command that identifies the process (e.g. pgrep -lf opensearch).

> And I don't understand how this stop command would do something like that
> # kill -15 `cat /var/run/opensearch/opensearch.pid`

rc.d doesn't use pid files. If the daemon exited without cleaning the
file (e.g in a crash) the pid may have been re-used by another process.

-- 
Please keep replies on the mailing list.

Reply via email to