2

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.

bonsaiviking
  • 4,420
  • 17
  • 26
javanix
  • 247
  • 4
  • 15

1 Answers1

4

Something like this script below?

#!/bin/bash
[ -z "$STY" ] && exec screen -S virtualbox "$0" "$@"

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

# uncomment following line to detach from screen
#screen -d
kupson
  • 3,578
  • 20
  • 19