In a script I am building I'm experimenting with how to automate as much as possible. One of the more interesting challenges is to connect to a byobu screen session and execute a command.
So I started in the obvious place, looking on how many screen sessions there are (game has 3 windows in byobu and lordquackstar has 2. The users are in separate putty instances)
game@quackgame:~$ screen -ls
There is a screen on:
2019.byobu (01/05/2011 05:10:04 PM) (Attached)
1 Socket in /var/run/screen/S-game.
Only one there, so I checked for the system
lordquackstar@quackgame:/home/game$ sudo ls -lAR /var/run/screen/
/var/run/screen/:
total 0
drwx------ 2 game users 100 2011-01-06 09:18 S-game
drwx------ 2 lordquackstar lordquackstar 100 2011-01-06 09:17 S-lordquackstar
/var/run/screen/S-game:
total 4
prwx------ 1 game users 0 2011-01-08 07:55 2019.byobu
-rw------- 1 game users 0 2011-01-06 09:18 byobu-exchange
-rw-r--r-- 1 game users 3 2011-01-08 07:32 byobu.updates-available
/var/run/screen/S-lordquackstar:
total 4
prwx------ 1 lordquackstar lordquackstar 0 2011-01-08 07:42 1169.byobu
-rw------- 1 lordquackstar lordquackstar 0 2011-01-06 09:17 byobu-exchange
-rw-r--r-- 1 lordquackstar lordquackstar 3 2011-01-08 07:35 byobu.updates-available
Still no multiple screens
So for my question: How can I connect to a window in byobu from a script?
On a slightly related note, once I connect to it from a bash script, is there any way to send it a command then detatch?
htop
showed multiple screen processes – TheLQ Jan 08 '11 at 13:38