EasyManuals Logo

Lantronix SLC 8000 Series User Manual

Lantronix SLC 8000 Series
425 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #212 background imageLoading...
Page #212 background image
9: Device Ports
SLCâ„¢ 8000 Advanced Console Manager User Guide 212
Expect Custom Script - SLC Device Port Session
An example of an Expect Custom Script that interacts with a SLC Device Port (in this example a
ServerTech PDU is connected to a Device Port):
#! expect
#
# Script to get the load of a ServerTech PDU outlet
#
set pduPrompt ">"
set pduLoad "unknown"
proc myprint {str} {
send_user -- "$str\n"
}
proc abortSession {err} {
send_user "Error $err. Terminating session.\n"
exit $err
}
set now [clock seconds]
set date [clock format $now -format {%D %R}]
myprint "Load of ServerTech PDU outlet B1 at $date"
# spawn the port session on a device port
if {[catch {spawn -noecho portsession -p $devicePort} result]} {
abortSession 1
}
set sessionId $spawn_id
# Handle eof
expect_after {
-i $sessionId eof {
myprint "Session unexpectedly terminated."
abortSession 2
}
}
set timeout 10
log_user 0
#
# Login to the PDU
# The "Error:*" pattern matches all error messages output by portsession
#
send "\n"
expect {
"Username:" { send "admn\n" }
"Error:*\r\n" { send_user $expect_out(0,string); abortSession 2 }
}

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Lantronix SLC 8000 Series and is the answer not in the manual?

Lantronix SLC 8000 Series Specifications

General IconGeneral
BrandLantronix
ModelSLC 8000 Series
CategorySwitch
LanguageEnglish

Related product manuals