I have a couple of VM images that I run on a regular basis on my FreeBSD 9.0 fileserver.

I have scripts written that start them with my desired settings (startUbuntuVM and startWindowsVM).

I would like to write a script that does the following:

1) Start a screen session named 'virtualbox'
2) Add one window named 'Ubuntu' that runs the 'startUbuntuVM' command.
3) Add a second window named 'Windows' that runs the 'startWindowsVM' command.

I've seen the -X flag for screen but as far as I can tell it only works from within another running screen process.

Is there any way to do what I want? I don't want to script it within .screenrc because I only want this to be done when I want, not during every screen session start.


Something like this script below?

[ -z "$STY" ] && exec screen -S virtualbox "$0" "$@"

screen -t Ubuntu ./startUbuntuVM
screen -t Windows ./startWindowsVM

# uncomment following line to detach from screen
#screen -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.