What is the equivalent of play stop for Play 2.1?
If I did play start, how do I cleanly terminate the process?
As stated in the doc:
When you run the start command, Play forks a new JVM and runs the default Netty HTTP server. The standard output stream is redirected to the Play console, so you can monitor its status.
The server’s process id is displayed at bootstrap and written to the RUNNING_PID file. To kill a running Play server, it is enough to send a SIGTERM to the process to properly shutdown the application.
If you type Ctrl+D, the Play console will quit, but the created server process will continue running in background. The forked JVM’s standard output stream is then closed, and logging can be read from the logs/application.log file.
So I think that you have to use play run instead of play start. Then you'll be able to use Ctrl+D to stop play.
To achieve this, you could modify the build.sbt file as described here.
TaskKey[Unit]("stop") := {
val pidFile = target.value / "universal" / "stage" / "RUNNING_PID"
if (!pidFile.exists) throw new Exception("App not started!")
val pid = IO.read(pidFile)
s"kill $pid".!
println(s"Stopped application with process ID $pid")
}
However, this only applies to *nix systems.