Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, March 24, 2009

HOWTO: Tell dynagen to open new screen windows in *nix

I realized I posted this in another window, but it looks like it belongs here.

You can configure dynagen in linux, mac, freebsd - pick your poison, to open console windows in existing screen sessions with proper naming.

To do this, simply add to your dynagen.ini file commenting out the existing telnet option:

# Uncomment below for Linux
#telnet = xterm -T %d -e telnet %h %p > /dev/null 2>&1 &
telnet = screen -X screen -t "%d Dynamips (%h:%p)" -l `if [ -z "\`ps axu | grep 'telnet %h %p' | grep -v grep\`" ]; then echo telnet %h %p; else echo '/bin/false'; fi`

Then, in dynagen, all you have to do is run con /all. This will only open each window -once-, and the small bash script we embedded in the telnet command will check for existing windows and abort opening any duplicates. See the screenshot for details.


=> con /all

This will go through each of the routers that appers in dynagen and open only one window under screen.

=> list
Name Type State Server Console
Client1 3640 running localhost:7200 2000
Client2 3640 running localhost:7200 2001
ISP 3640 running localhost:7200 2002
Hub 3640 running localhost:7200 2003
Server 3640 running localhost:7200 2004
fw1 525 running localhost:10525 4000
fw2 525 running localhost:10525 4001


To manipulate screen, the default meta-key is CTRL+A. Combine this with another key, like space, to scroll through windows. Use a specific number to go to that window number CTRL+A, space or CTRL+A, 1.
Renaming a window is CTRL+A, a and listing current windows is done by CTRL+A, ".

For a list of other screen metakeys and functions read the screen manual or type CTRL+A, ? for other options

Posted by JP