matrei commented on code in PR #15698:
URL: https://github.com/apache/grails-core/pull/15698#discussion_r3354677962
##########
grails-doc/src/en/ref/Command Line/stop-app.adoc:
##########
@@ -25,30 +25,38 @@ under the License.
=== Purpose
-Stops a running Grails application in an embedded servlet container.
+Stops a Grails application that was started with the
link:{commandLineRef}run-app.html[run-app] command.
-NOTE: This command will work in development mode only.
+NOTE: This command works in development mode only.
=== Examples
[source,groovy]
----
-grails stop-app
-grails stop-app --port=9090 --host=mywebsite
+$ grails
+grails> run-app
+grails> stop-app
+----
+
+It can also be run as a separate invocation, including from a different
terminal than the one that started the application:
+
+[source,bash]
+----
+$ grails stop-app
----
=== Description
-Arguments:
+When an application is started with `run-app`, it runs as a forked Gradle
`bootRun` process which writes its process id to a `run-app.pid` file in the
project `build` directory. The `stop-app` command reads that file and asks the
operating system to stop the process, then removes the file.
+
+Because the running process is tracked through a file on disk rather than
in-memory state, `stop-app` can stop the application even when it was forked
into a separate process or when `stop-app` is run from a different `grails`
invocation than the one that started it.
-* `port` - Specifies the port which the Grails application is running on
(defaults to 8080 for HTTP or 8443 for HTTPS)
-* `host` - Specifies the host the Grails application is bound to
+This is a CLI only mechanism: it does not require the Spring Boot Actuator
shutdown endpoint to be enabled, nor does it rely on JMX.
Review Comment:
I don't think we need to explain this in the documentation.
##########
grails-profiles/base/commands/stop-app.groovy:
##########
Review Comment:
Tried it out and got this:
```console
mattias@mr-p920:~/Projects/tmp/grails-core/grails-shell-cli/build/install/grails-shell-cli$
./bin/grails-shell-cli create-app myapp
Resolving dependencies...
| Application created at
/home/mattias/Projects/tmp/grails-core/grails-shell-cli/build/install/grails-shell-cli/myapp
mattias@mr-p920:~/Projects/tmp/grails-core/grails-shell-cli/build/install/grails-shell-cli$
cd myapp
| Resolving Dependencies. Please wait...
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
grails> run-app
| Running application.....
>
<
> ____ _ _
<
> / ___|_ __ __ _(_) |___
<
> | | _| '__/ _` | | / __|
<
> | |_| | | | (_| | | \__ \
<
> \____|_| \__,_|_|_|___/
<
> https://grails.apache.org
<
>
<
Grails application running at http://localhost:8080 in environment:
development
<=======<=======<===========--> 85% EXECUTING [26s]
> :bootRun
grails> stop-app
| Shutti<===========--> 85% EXECUTING [1m 39s]
| Error Application not running. (Use --stacktrace to see the full trace)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]