12: Scripts
EMG™ Edge Management Gateway User Guide
266
Expect Custom Script - EMG CLI Session
An example of an Expect Custom Script that interacts with an EMG CLI session:
#! expect
# script to get the current internal temperature of the EMG
# accepts one optional command line parameter for location
set emgPrompt ">"
set emgTemp "unknown"
set location ""
proc myprint {str} {
send_user -- "$str\n"
}
proc abortSession {err} {
send_user "Error $err. Terminating session.\n"
exit $err
}
# Are there any command line parameters?
if {$argc > 0} {
set location [lindex $argv 0]
}
set now [clock seconds]
set date [clock format $now -format {%D %R}]
if {$argc > 0} {
myprint "Internal temperature of the $location EMG at $date"
} else {
myprint "Internal temperature of the EMG at $date"
}
# spawn the CLI session
if {[catch {spawn -noecho clisession -U sysadmin} 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
# Wait for the first prompt
set loggedIn false
while {! $loggedIn} {
Содержание EMG 7500
Страница 1: ...Part Number PMD 00008 Revision C April 2020 EMG Edge Management Gateway User Guide EMG 8500 EMG 7500 ...
Страница 82: ...7 Networking EMG Edge Management Gateway User Guide 82 Figure 7 2 Network Network Settings 2 of 2 ...
Страница 100: ...7 Networking EMG Edge Management Gateway User Guide 100 Figure 7 5 Network Wireless Settings ...
Страница 353: ...15 Maintenance EMG Edge Management Gateway User Guide 353 Figure 15 12 About EMG ...
Страница 474: ...EMG Edge Management Gateway User Guide 474 Figure E 3 EU Declaration of Conformity ...
Страница 475: ...EMG Edge Management Gateway User Guide 475 Figure E 4 EU Declaration of Conformity continued ...