Skip to ContentSkip to Footer
Start of content
- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- Troubleshooting script that uses expect
General
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-28-2008 03:33 PM
02-28-2008 03:33 PM
Troubleshooting script that uses expect
Hi there --
I am writing a script that is designed to automate the interactive responses that are user would enter to gain access to a remote server. I have expect installed on the local workstation, which in this case is a Fedora Core 2 system.
The script consists of two parts. The first part references the expect file in question, while the second part is the expect file. Listed below are the two files:
tps_expect script:
Code:
#!/bin/bash
# This script will provide access to the tcs application which
# is located on the remote server.
# First disable access control so that only the tps server can connect
# to this client.
xhost +
# Establish a telnet session with mcrs1. NOTE: The address in question is
# the address that mcrs1 has on the Partners network, and not the internal
# tcs network address. The syntax shown below is designed to prompt the
# operator for the appropriate username and password.
expect start_pts.expect
start_pts.expect script:
Code:
#!/bin/tcsh
# This script runs in conjunction with the tps_expect script.
# It uses the expect utility to automate several interactive
# commands the user would normally enter.
spawn telnet mcrs1
expect {
login: {tps
send "username\n"
}
}
expect {
Password: {tps
send "mypassword\n"
}
}
expect {
"$ " {
send setenv DIPSLAY:0.0\n"
}
}
expect {
"$ " {
send "exec cd /TCS_MGH/TPRRuntime/\n"
}
}
expect {
"$ " {
send "exec startTPR.pl\n"
}
}
When I run the tps_expect script, here is the output that I encounter:
Quote:
being added to access control list
spawn telnet
Trying...
Connected to.
Escape character is '^]'.
HP-UX B.10.20 E 9000/785 (ttyp3)
login: invalid command name "tps"
while executing
"tps"
invoked from within
"expect -nobrace login: {tps
send "username\n"
}"
invoked from within
"expect {
login: {tps
send "username\n"
}
}"
(file "start_pts.expect" line 8)
Can someone help me correct the syntax errors in question? Thanks
I am writing a script that is designed to automate the interactive responses that are user would enter to gain access to a remote server. I have expect installed on the local workstation, which in this case is a Fedora Core 2 system.
The script consists of two parts. The first part references the expect file in question, while the second part is the expect file. Listed below are the two files:
tps_expect script:
Code:
#!/bin/bash
# This script will provide access to the tcs application which
# is located on the remote server.
# First disable access control so that only the tps server can connect
# to this client.
xhost +
# Establish a telnet session with mcrs1. NOTE: The address in question is
# the address that mcrs1 has on the Partners network, and not the internal
# tcs network address. The syntax shown below is designed to prompt the
# operator for the appropriate username and password.
expect start_pts.expect
start_pts.expect script:
Code:
#!/bin/tcsh
# This script runs in conjunction with the tps_expect script.
# It uses the expect utility to automate several interactive
# commands the user would normally enter.
spawn telnet mcrs1
expect {
login: {tps
send "username\n"
}
}
expect {
Password: {tps
send "mypassword\n"
}
}
expect {
"$ " {
send setenv DIPSLAY
}
}
expect {
"$ " {
send "exec cd /TCS_MGH/TPRRuntime/\n"
}
}
expect {
"$ " {
send "exec startTPR.pl\n"
}
}
When I run the tps_expect script, here is the output that I encounter:
Quote:
spawn telnet
Trying
Connected to
Escape character is '^]'.
HP-UX
login: invalid command name "tps"
while executing
"tps"
invoked from within
"expect -nobrace login: {tps
send "username\n"
}"
invoked from within
"expect {
login: {tps
send "username\n"
}
}"
(file "start_pts.expect" line 8)
Can someone help me correct the syntax errors in question? Thanks
A Journey In The Quest Of Knowledge
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
End of content
United States
Hewlett Packard Enterprise International
Communities
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP