Liste user on Itanium console

From Tuxunix
Jump to: navigation, search
#!/usr/bin/expect
 
# input arguments
set host [lindex $argv 0]
set user [lindex $argv 1]
set passwd [lindex $argv 2]
 
# check for arguments
if {[llength $argv] != 3 } {
        puts "\n Usage: scriptname host user password \n"
        puts "\n Example: concheck-hpux.exp g7u1111 g7u1111 xxxxxxx \n"
        puts "Note: the script works only if console allows SSH"
        exit 1
}
 
puts "\n ############ Liste User console for $host ########### \n"
 
# start process
#spawn telnet ${user}@${host}-c
#Cnx
spawn ssh -o StrictHostKeyChecking=no ${user}@${host}
expect "password:"
send "${passwd}\r"
 
expect "(.*)MP> "
send "cm\r"
 
expect "(.*)CM> "
send "uc\r"
 
expect "(.*)Quit:"
send "L\r"
 
puts "\n------- End list ---------- \n"
expect "(.*)Quit:"
send "Q\r"
 
expect "(.*)Quit:"
send "Q\r"
 
expect "(.*)CM>"
send "exit\r"
 
expect "(.*)MP>"
send "X\r"
 
exit 0