- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: 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
Forums
Discussions
Discussions
Forums
Discussions
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
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
06-02-2005 12:56 AM
06-02-2005 12:56 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 01:10 AM
06-02-2005 01:10 AM
Re: telnet script
Thats becaue you have to provide a password which must be hardcoded into the script and is tranmitted across the network in clear text.
But:
You can do this:
Install this:
http://software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA
Set up password free public key exchange according to the word document I'm attaching:
Then run this check with ssh.
make a list of servers
serverlist
server1
server2
Then this little loop:
user=testit
while read -r server
do
ssh ${user}@${server} "exit"
rc=$?
if [ $rc -eq 0 ]
then
echo "${server} is up"
else
echo "${server} may have a problem"
#perhaps email out a notice.
fi
done < serverlist
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 01:24 AM
06-02-2005 01:24 AM
Solution- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 01:36 AM
06-02-2005 01:36 AM
Re: telnet script
You could easily script the telnet to other machines. No problem there. BUT the problem is what happens when you actually connect to the other machine? The machine you started the script on will lose control and your script will just sit there because it can't do anything on the remote machine.
So essentially you will successfully telnet to the first host, and then nothing will happen. It MIGHT proceed to the next host when the telnet connection times out, but no guarantee.
I would look at another way of verifying connectivity. telnet is not a good test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 01:59 AM
06-02-2005 01:59 AM
Re: telnet script
then create this script:
#!/usr/bin/perl
use Net::Telnet ();
while (
chop;
my $remote_host = $_;
printf("%s:",$remote_host);
$pop = new Net::Telnet (Timeout => 10);
$prev = $pop->errmode("return");
$pop->open(Host => $remote_host,
Port => 23);
$msgline = $pop->errmsg;
if ($msgline = $pop->errmsg) {
printf("%s.\n",$msgline);
} else {
printf("responded.\n");
}
}
then to use:
cat FILENAMEOFSYSTEMS | SCRIPTNAME
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 02:04 AM
06-02-2005 02:04 AM
Re: telnet script
telnet works fine, and you really don't need to login:
Here is some sample INPUT:
[root@vpart1 /]# cat /var/appl/perlscripts/tstports.data
vpart1
vpart2
vpart3
rndspt01
rndspt02
rndspt03
rndspt09
Here is the OUTPUT:
[root@vpart1 /]# cat /var/appl/perlscripts/tstports.data | /var/appl/perlscripts/tstports.pl
vpart1:responded.
vpart2:problem connecting to "vpart2", port 23: connect timed-out.
vpart3:responded.
rndspt01:responded.
rndspt02:responded.
rndspt03:responded.
rndspt09:problem connecting to "rndspt09", port 23: Connection refused.
SPECIAL NOTES:
vpart2 does not exist
rndspt09 is a WINDOZE box, thus has no telnetd running!
I put the output in the perl prog to use colon's (:) so you can "parse" and grep as you like!!!
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 02:12 AM
06-02-2005 02:12 AM
Re: telnet script
download it somewhere (anywhere)
gunzip Net-Telnet-3.03.tar.gz
tar -xvf Net-Telnet-3.03.tar
cd Net-Telnet-3.03
perl Makefile.PL
make
make test
make install
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 02:13 AM
06-02-2005 02:13 AM
Re: telnet script
You can setup ssh to login to other systems without passwds.
All of this is done encrypted. Much better security.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 02:16 AM
06-02-2005 02:16 AM
Re: telnet script
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 03:10 AM
06-02-2005 03:10 AM