chip
chip

Reputation: 3279

how to restart a grails web application

how can I restart a grails application other than shutting it down by doing ctrl z and running it again.

when I do it that way it says

Error Server failed to start for port 8080: Address already in use

Upvotes: 1

Views: 2880

Answers (4)

Chip McCormick
Chip McCormick

Reputation: 744

Shutdown should not require process hacking and doesn't require a 'could ruin everything' disclaimer :)

Just run:

grails stop-app

Upvotes: 3

sparkyspider
sparkyspider

Reputation: 13519

If that still doesn't work:

lsof -i :8080 or ps aux | grep grails

Will show the process id, then first try killing it nicely:

kill 12345 (where 12345 is the processId)

Of if it really doesn't want to play nicely, then HAMMER it with:

kill -9 12345 (where 12345 is the processId)

Works every time (DISCLAIMER: Could ruin everything)

Upvotes: 2

tim_yates
tim_yates

Reputation: 171084

CTRL-Z doesn't shut down an application, sends a SIGTSTP signal to the process to suspend it... Suspended processes still have connections to their resources (ports, files, etc), so you cannot run another instance of grails on the same port whilst one is suspended.

To bring it back to the foreground, you can enter fg in the same shell (or if you want it to run in the background, you can use bg)

To shut it down, you need CTRL-C (or you can kill it as nickdos says in the comments)

Upvotes: 7

Ian Roberts
Ian Roberts

Reputation: 122364

To cleanly shut down a run-app or run-war, create an empty file named .kill-run-app in the top-level directory of your grails application (i.e. alongside grails-app, src, etc.). Grails will automatically delete this file once the application has been stopped, so don't be surprised when it disappears shortly after you created it.

Upvotes: 5

Related Questions