Alex Rivera | Logout

How to use command to shutdown grails run-app

Asked 2010-08-27T15:42:48.037
18

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

Edit
Report

1 Answer

1

I found a neat way that works on Grails 2.0.1 for me.

This is a hack that uses a hack put in GrailsRun.groovy for shutting down servers after running functional tests. (see line 246)

Create a file in the application basedir named .kill-run-app

When Grails sees the .kill-run-app file, it issues a grailsServer.stop(). It also conveniently deletes the file. This may depend on having autoRecompile on. I'm not sure, like I said this is a hack.

One day it will most likely cease to work when the GrailsRun.groovy script is changed.

I created a simple Ant target to do this. Granted you will need another terminal to execute it (actually I run it from Eclipse).

<target name="kill-app" description="--> Kills Grails web application" depends="">
  <touch file="${basedir}/.kill-run-app"/>
</target>
answered 2012-05-07T14:20:19.057

Your Answer