-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add help argument for hz-stop script #19749
Conversation
Thanks for the PR! |
@frant-hartm Is there anything else I need to do at my end? I don't see a merge option and I am not really sure what your process dictates. |
@Chelsea31 Nothing to do on your side, I will get another colleague to review and then we will merge this. |
@@ -1,5 +1,12 @@ | |||
#!/bin/bash | |||
|
|||
if [ "$1" = "help" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |||
echo "Usage : hz-stop" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about avoiding the hardcoded script name?
echo "Usage : hz-stop" | |
echo "Usage : $0" |
if [ "$1" = "help" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | ||
echo "Usage : hz-stop" | ||
echo "Used to stop any running instances of HazelcastMemberStarter." | ||
echo "Finds any processes matching com.hazelcast.core.server.HazelcastMemberStarter and stops all of them." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could extract com.hazelcast.core.server.HazelcastMemberStarter
to avoid duplication here:
echo "Finds any processes matching com.hazelcast.core.server.HazelcastMemberStarter and stops all of them." | |
echo "Finds any processes matching $PROCESS_MATCHER and stops all of them." |
and here:
PIDS=$(ps ax | grep "$PROCESS_MATCHER" | grep -v grep | awk '{print $1}')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ldziedziul I have included both of your suggestions in my PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* Add hz command to the default distribution package HZ-625 (#20262) * Fix javadoc in distribution module HZ-625 (#20364) * Fix hanging HzStartTest (#20489) The Hazelcast process wasn't being killed correctly and in combination with java.lang.ProcessBuilder#inheritIO the JVM running the test was hanging at shut down (the test passed correctly). There were 2 issues causing improper shutdown: - the scripts hz/hz-start were not using exec command which replaces current shell process with the command, this resulted in killing the shell, but that doesn't immediatelly kill the HazelcastServerCommandLine process. Using exec means we kill the HazelcastServerCommandLine directly. - similarly the HazelcastServerCommandLine starts a new process (HazelcastMemberStarter) and when it is killed it doesn't automatically kill the new process. Added shutdown hook so the process is killed in normal scenario (it won't be killed correclty if `kill -9` is used, but we can't do anything about that). Fixes hazelcast/hazelcast-enterprise#4425 * Add help argument for hz-stop script (#19749) Fixes #19726 * Remove intermediate Java process in hz script [HZ-884] (#20687) Intermediate Java process was used to provide additional classpath or JVM parameters from command line parameters. However, there are issues with the approach: - there are 2 JVMs running, consuming resources - it's not clear to the user what the processes are for, what should be killed - killing with `kill -9` the parent process actually doesn't kill the child process Co-authored-by: Łukasz Dziedziul <lukasz.dziedziul@hazelcast.com> Co-authored-by: Chelsea31 <31530304+Chelsea31@users.noreply.github.com>
Fixes #19726