HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Troubleshooting script that uses expect
Operating System - Linux
1827855
Members
1596
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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
- 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.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP