[Date Prev] [Date Index] [Date Next] [Thread Prev] [Thread Index] [Thread Next]

Re: Help with 'initcmd'

Fabien Wernli wernli@in2p3.fr
Fri, 1 Jun 2007 07:05:15 -0700 (PDT)


Hi,

On Fri, Jun 01, 2007 at 03:40:13PM +0200, Kenneth Vestergaard Schmidt wrote:
> I'm trying to get conserver to talk to our Sun Fire X2100 eLOM consoles
> via ssh, and used the trick described on
> http://www.laen.org/2006/10/09/conserver-and-sun-x4100s/ to do

I also wrote a script, maybe you wanna try it instead. I submitted it to
conserver.com, but the author seems quite busy.

Here is conserver.cf (expect script is attached):

--

default x4100 {
        type exec;
        execsubst Z=cs;
        exec /opt/conserver/ilom/sol.ilom Z;
        break 1;
        motd "Sun Fire x4100. Use \"Ctrl+E c ?\" for help, \"Esc (\" to
reinit";
}

console ilom1 { include x4100; }

--

just adapt username/password in attached script

#!/usr/bin/expect -f
#
# script for SUN ILOM on x4x00 series
# tested on ILOM 1.0.3
# this will probably be obsoleted in future revisions
# when ipmi 2.0 SOL will be supported on these boxes
# connects to $username@$ilom
# and starts SOL command
# Also checks for Terminated Serial command
# To re-init SOL connection on ILOM
# either down/up console or use "Esc ("
# send fixes/improvements to
# fabien@wernli.eu
#

set ilom [lindex $argv 0]
set username "USERNAME"
set password "PASSWORD"
set cmdline "start -script /SP/console"
set prompt "^.*-> $"
set respawn "Serial console stopped."

spawn /usr/bin/ssh -e\[ $username@$ilom
match_max 10000
expect -re ".*password: "
send "$password\r"
expect -re $prompt
send "$cmdline\r"
while 1 {
	expect {
		eof {
			sleep 5
			exit
		}
		-re $prompt { 
			sleep 5
			send "$cmdline\r"
		}
		"?" {
			interact {
				-o
				$respawn {  
					sleep 5
					send "$cmdline\r"
				}
				eof {
					exit
				}
			}
		}
		exit
	}
}
exit