- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unix 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
Forums
Discussions
Discussions
Discussions
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
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
10-26-2001 09:51 AM
10-26-2001 09:51 AM
Our HP-UX boxes are connected via the network to some equipment we manage.
We can open a telnet session on these equipments and enter some administrative commands:
telnet x.x.x.x
5 (access level)
xxxxxxxxx (password)
Maint
etc...
exit
I was asked to write a script to run on the HP-UX box to automate these procedures.
Any suggestions?
TIA,
Kind Regards,
Rui.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2001 09:59 AM
10-26-2001 09:59 AM
Re: Unix script
For routers, switches, your best bet is to use expect and create an expect script that does this.
Here are some examples:
http://tcl.activestate.com:8002/resource/software/extensions/expect/
If its a server, I would suggest using remsh or ssh instead of passing passwords around.
You can try passing commands directly to the telnet sessions by redirecting commands to it, but that is difficult as telnet is interactive. Expect is the best way to anticpate what response you will have and issue the commands at the appropriate time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2001 10:03 AM
10-26-2001 10:03 AM
Re: Unix script
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2001 10:37 AM
10-26-2001 10:37 AM
SolutionYou could try something like
/Begin/
#!/usr/bin/sh
# here hostname is the name of the remote machine
# username is the name of the user
# password is the password of the user username
REMOTE=hostname
(sleep 5
echo username
sleep 5
echo password
sleep 15
echo "ls -ald /tmp"
sleep 5
echo exit) |telnet $REMOTE
/End/
this is to connect to regular servers, The same could be modified to connect to switches/routers etc.
The other option is to use expect and/or write perl program using expect.pm module.
-HTH
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2001 05:47 AM
10-27-2001 05:47 AM
Re: Unix script
Bernie, Harry and Ramesh, thanks a lot
for your contribution!
Ramesh your solution is exactly what I was looking for.
Many thanks,
Kind Regards,
Rui.