Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detach screen programmatically in linux?

This question is about the linux utility screen.

I'd like to make a script to launch a program in screen then detatch it automatically after it starts.

I've got the script starting screen, starting the command in screen, but my question is now how do I detach it?

Thanks

like image 877
Travis Avatar asked Oct 04 '10 01:10

Travis


People also ask

How do I detach a screen session in Linux?

Basic Linux Screen Usage Use the key sequence Ctrl-a + Ctrl-d to detach from the screen session. Reattach to the screen session by typing screen -r .

How do I run my screen in detached mode?

Detatch from the screen session using the key sequence Ctrl-a Ctrl-d (note that all screen key bindings start with Ctrl-a ). This will drop you back to your original shell and display a message "[detached]", indicating that the screen session is still running.

How do you detach a screen from a monitor?

Use ctrl + a , a to send ctrl + a to the inner screen. That is, to detach the inner screen press ctrl + a , a , d .


1 Answers

Don't attach in the first place. From the screen manual:

  -d -m   Start screen in "detached" mode. This creates a new session but
          doesn't  attach  to  it.  This  is  useful  for  system startup
          scripts.
like image 83
Logan Capaldo Avatar answered Sep 17 '22 16:09

Logan Capaldo