Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.