- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Automating telnet script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО01-26-2005 08:22 PM
тАО01-26-2005 08:22 PM
I'm on HPUX 11.11i. Does anyone know if it is possible to automate a telnet script & pass in the username, password & a command and the exit. For testing purposes, I need to write a script to telnet to a router & run the command "sh dialer". I can't seem to find a way to pass the details to telnet from a file.
what I need to do in words is:
telnet 11.11.111.111 (i.e. IP address)
input USERNAME
input PASSWORD
sh dialer
exit
This will be run in the crontab overnight & thescreen output send to a log file for monitoring
Thanks,
Tim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 08:35 PM
тАО01-26-2005 08:35 PM
Re: Automating telnet script
I think the following should work, i don't have access to a Unix system right now to verify
$ telnet 11.11.111.111
USERNAME
PASSWORD
sh dialer
exit
OR
$ telnet 11.11.111.111 USERNAME PASSWORD
sh dialer
exit
Try and let me know if one of the above works
rgds
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 08:36 PM
тАО01-26-2005 08:36 PM
Solutionthe normal way for doing this in a production environment would be via expect.
See
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=45609
for solution of your problem.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2005 09:55 PM
тАО01-26-2005 09:55 PM
Re: Automating telnet script
The telnet commands did'nt work
Will look at Expect.
Points assigned
Thanks,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2005 02:19 PM
тАО01-30-2005 02:19 PM
Re: Automating telnet script
#!/usr/local/bin/expect -f
spawn telnet 123.123.123.123
expect "login:"
send "snoopy\r"
expect "Password:"
send "snoopy\r"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2005 09:38 AM
тАО01-31-2005 09:38 AM
Re: Automating telnet script
Try echo "$USERNAME\r$PASSWORD\r$COMMAND"|telnet HOST.
(The \r is the equivalent of the
This is really ugly, but might work for you. I can't test this on any of my systems here or the security people would have my head on a platter--and rightfully so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2005 09:58 AM
тАО01-31-2005 09:58 AM
Re: Automating telnet script
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2005 10:08 AM
тАО01-31-2005 10:08 AM
Re: Automating telnet script
not work for telnet as telnet, by default, reads from
tty.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2005 08:54 PM
тАО01-31-2005 08:54 PM
Re: Automating telnet script
router=99.99.999.99
(echo PASSWORD
sleep 2
echo sh isdn act
sleep 2
echo exit
while read cmd
do
echo $cmd
done
)|telnet $router | tee /tmp/ky_routers_up.log
Points awarded,
Thanks
Tim