Skip to content
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

Merged
merged 3 commits into from
Oct 22, 2021
Merged

Conversation

Chelsea31
Copy link
Contributor

@Chelsea31 Chelsea31 commented Oct 10, 2021

Fixes #19726

@hz-devops-test hz-devops-test added the Source: Community PR or issue was opened by a community user label Oct 10, 2021
@frant-hartm frant-hartm changed the title adding help argument for hz-stop script Add help argument for hz-stop script Oct 15, 2021
@frant-hartm
Copy link
Contributor

Thanks for the PR!

@Chelsea31
Copy link
Contributor Author

@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.

@frant-hartm
Copy link
Contributor

@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"
Copy link
Contributor

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?

Suggested change
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."
Copy link
Contributor

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:

Suggested change
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}')

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@frant-hartm frant-hartm merged commit e817a03 into hazelcast:master Oct 22, 2021
@hazelcast hazelcast deleted a comment from devOpsHazelcast Jan 3, 2022
@hazelcast hazelcast deleted a comment from devOpsHazelcast Jan 3, 2022
@hazelcast hazelcast deleted a comment from devOpsHazelcast Jan 3, 2022
@hazelcast hazelcast deleted a comment from frant-hartm Jan 3, 2022
@hazelcast hazelcast deleted a comment from ldziedziul Jan 3, 2022
frant-hartm pushed a commit to frant-hartm/hazelcast that referenced this pull request Feb 22, 2022
@frant-hartm frant-hartm mentioned this pull request Feb 22, 2022
4 tasks
frant-hartm added a commit that referenced this pull request Mar 3, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: CLI Source: Community PR or issue was opened by a community user Team: Core Type: Defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hz-stop --help doesn't print help, but runs the command instead
5 participants