Did you really mean to put the \
at the end of the line? If not then try removing those - they escape the following character.
also, dropping the -X
helps the setup work for me, for instance:
screen -S test -d -m -X touch /tmp/test
fails with No screen session found
, however:
screen -S test -d -m touch /tmp/test
works fine. As such I suspect the following will work for you:
#!/bin/bash
screen -S test -d -m $HOME/folder/folder/.program
screen -S test2 -d -m $HOME/folder/folder/.program2
Remember, that if you run this at boot time, $HOME is not the same as after you log in as a specific user. If you need to run it as a certain user you'll need to use the likes of su
to run it as that user, and specifying the full path will remove any ambiguity:
#!/bin/bash
screen -S test -d -m su - username /home/username/folder/folder/.program
screen -S test2 -d -m su - username /home/username/folder/folder/.program2
Or, you would call the entire script above as su - username /path/to/your/script
.
There are two levels of "listings" involved here. First, you have the "window listing" within an individual session, which is what ctrl-A A is for, and second there is a "session listing" which is what you have pasted in your question and what can also be viewed with screen -ls
.
You can customize the session names with the -S
parameter, otherwise it uses your hostname (teamviggy), for example:
$ screen
(ctrl-A d to detach)
$ screen -S myprogramrunningunderscreen
(ctrl-A d to detach)
$ screen -ls
There are screens on:
4964.myprogramrunningunderscreen (05/31/2013 09:42:29 PM) (Detached)
4874.pts-1.creeper (05/31/2013 09:39:12 PM) (Detached)
2 Sockets in /var/run/screen/S-paul.
As a bonus, you can use an unambiguous abbreviation of the name you pass to -S
later to reconnect:
screen -r myprog
(I am reconnected to the myprogramrunningunderscreen
session)
Best Answer
Ctrl+a followed by d. Note the lower case. The [
screen
manpage] has a long list of these shortcuts under "DEFAULT KEY BINDINGS".