How to use command to shutdown grails run-app

For Stop Server

Exit from the terminal and use any one from the commands below:

  • grails exit
  • grails stop-app
  • grails quit

No. grails run-app is intended to be run for development, interactively.

If you want to control grails as a service, you should deploy it to a web application container such as tomcat. The tomcat plugin allows you to easily deploy your app to tomcat, for example. Add lines like

tomcat.deploy.username="manager"
tomcat.deploy.password="secret"
tomcat.deploy.url="http://myserver.com/manager"

to Config.groovy and then you can use

grails tomcat deploy
grails tomcat undeploy

to start and stop your application. Alternatively, you can use grails war to bundle your app into a war archive which all java app servers should be able to use.

If you really want to stop grails run-app without Ctrl+C, write a small controller that calls System.exit(0). Then browse to that URL, or write a small shell script or batch file that invokes it with e.g. wget or curl.