So, I have a command which starts a webserver, it goes step by step and puts output to standard output. It goes like:

step 1...
step 2...
step 3...
server up and running on port 9000

However, this gets stuck waiting user input (this is typesafe activator) and when launched from command line doesn't finish. How do I detach from this script waiting for user input and let it run, but continue with the parent shell? I want to detach as soon as I see that server is running.

  • Can you show the command line you're executing (per How to Ask)? – boardrider May 15 '15 at 6:30
  • ./activator Does it really matter? I want to grep it's output and stop detach on certain regex – user289067 May 15 '15 at 15:40

Option #1: When the server is running, type Ctrl+Z and bg. Ctrl+Z will pause the process execution and bg will send the process to the background releasing the shell for new user input. Warn: your server is tied to the running shell. If you logout from that shell the server will be killed.

Option #2: Launch your script with nohup, which will run your script detached from the terminal. Example: nohup ./activator.

Option #3: Launch your script inside a screen session and then detach from the session via Ctrl+d.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.