grailsshutdownrun-app

How to use command to shutdown grails run-app


After executing grails run-app, except using Ctrl + C", is there a command to shutdown it?


Solution

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