1

How to keep play application running after putty terminal closed?

After deploying play application in to server, I ssh'ed into server with putty terminal and ran the play application.

However, once I close the putty terminal, play application no longer accepts http requests from client. To start the play application I used following command;

./{myplayapp}/bin/{executable} -Dhttp.port=8000
Venkatesh
  • 3,558
  • 8
  • 32
  • 38
  • possible duplicate of [How to detach a process from terminal in unix?](http://stackoverflow.com/questions/11807688/how-to-detach-a-process-from-terminal-in-unix) – Martin Prikryl Dec 09 '14 at 07:51

3 Answers3

3

use screen to start your application. view existing screens with "screen -ls" and switch between them with "screen -r" http://wiki.ubuntuusers.de/screen

Watte
  • 58
  • 5
2

I would recommend nohup:

nohup ./script -Dhttp.port=8000 &

It will create nohup.out file with all the logs. If you want to quit it, grep RUNNING_PID and sudo kill it.

Mon Calamari
  • 4,403
  • 3
  • 26
  • 44
1

Got the answer! Using & symbol run the process in background so that even if putty terminal is closed, process not terminated.

./{myplayapp}/bin/{executable} -Dhttp.port=8000 > app.out &
Venkatesh
  • 3,558
  • 8
  • 32
  • 38
  • screen (see answer above) is a nicer solution. It's a terminal you can jump in and out of, detach from, share with others. It's perfect for things like this. – Shanness Dec 09 '14 at 02:06
  • Agreed. Screen is the best solution. "&" doesn't seem to work reliably – Venkatesh Dec 20 '14 at 17:40