10 Replies Latest reply on Oct 11, 2011 1:02 PM by chrishiner

    Stopping JBoss 7 through CLI

    semubiz

      Hi

       

      I would like to shutdown JBoss 7 through the command line interface (CLI).

       

      In the User Guide i found this snippet:

       

      ./jboss-admin.sh --connect command=:shutdown

       

      In my installation, only authenticated users can connect to the management interface (it's configured in the standalone.xml with security-realm="PropertiesMgmtSecurityRealm" in management-interface). This means, if I execute the above command it fails, because of missing authentication. I can only connect in interactive mode (execute ./jboss-admin.sh and then input to the prompt).

       

      I would like to write a batch script which can connect to the management interface and authenticate itself. In JBoss 6 that was possible with the arguments -u (user) and -p (password) for ./shutdown.sh.

       

      Does anyone have a clue?

       

      Thank you

        • 1. Re: Stopping JBoss 7 through CLI
          fabrizio.benedetti

          I found same issue.

           

          I solved with a workaround, disabling security-realm in native-interface and setting management interface's inet-address to "localhost".

           

          My standalone.xml looks like:

          ...

          <management>

              <security-realms>

                  <security-realm name="PropertiesMgmtSecurityRealm">

                      <authentication>

                          <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>

                      </authentication>

                  </security-realm>

              </security-realms>

              <management-interfaces>

                  <native-interface interface="management" port="9999"/>

                  <http-interface interface="public" port="9990" security-realm="PropertiesMgmtSecurityRealm"/>

              </management-interfaces>

          </management>

          ...

          <interfaces>

              <interface name="management">

                  <inet-address value="localhost"/>

              </interface>

              <interface name="public">

                  <inet-address value="192.168.1.1"/>

              </interface>

          </interfaces>

          ...

           

           

          It is a problem only if you want to launch you script remotely.

          • 2. Re: Stopping JBoss 7 through CLI
            rhusar

            Hi guys,

             

            that surely needs improving, here is a Jira for it:

             

            https://issues.jboss.org/browse/AS7-2036

             

            Fabrizio that is a hack, but nice workaround :-)

             

            Thanks,

            Rado

            • 3. Re: Stopping JBoss 7 through CLI
              dlofthouse

              I have scheduled the issue - we will get support for specifying the username and password added.

              • 4. Re: Stopping JBoss 7 through CLI
                rhusar

                Thanks Darran.

                • 5. Re: Stopping JBoss 7 through CLI
                  semubiz

                  Thanks for your replies. As there is no support currently I'll go with Fabrizio's suggestion.

                  • 6. Re: Stopping JBoss 7 through CLI
                    dlofthouse

                    Just a quick update.

                     

                    I am just running the changes past the lead for the CLI so the changed can be added to the repo but for the scenarios described in this thread I have now added support for the username and password to be specified on the command line and if authentication is required and the values have not been set the users will be prompted to supply the missing values.

                    • 7. Re: Stopping JBoss 7 through CLI
                      chrishiner

                      Would it make sense to have an option to specify a file with credentials in it, so they don't have to be passed on the command line?

                       

                      I worked around the lack of username/password options with an Expect script, but that's overkill for most things.

                      • 8. Re: Stopping JBoss 7 through CLI
                        dlofthouse

                        That could also be an option although at this stage I think that would be more likely if it was contributed from the community.

                         

                        My next tasks are to look at some of the non-password based authentication mechanisms for our management interfaces so those will also become alternatives to needing to pass in a username and password on the command line.

                        • 9. Re: Stopping JBoss 7 through CLI
                          rhusar

                          Chris Hiner wrote:

                           

                          Would it make sense to have an option to specify a file with credentials in it, so they don't have to be passed on the command line?

                           

                          I worked around the lack of username/password options with an Expect script, but that's overkill for most things.

                          Hey Chris, here is a Jira for it:

                           

                          https://issues.jboss.org/browse/AS7-2072

                           

                          As Darran says, feel free to take it on if you would dare ;-)

                          • 10. Re: Stopping JBoss 7 through CLI
                            chrishiner

                            I think I'll wait and see what Darran comes up with.  Non-password based authentication mechanisms sounds like an even better answer for future use.