SUMMARY Telnet in a crontab job.

From: Modrego K. SBD <ModregoK_at_bancsabadell.com>
Date: Thu Oct 11 2001 - 05:17:31 EDT
Firt of all... my apologies for the late summary.

Thanks to.
Hendrik Visage
ieven.marchand
matthew.hannigan
Tim Yocum
Bill Mooney=20
Michael Maciolek=20
Jordan Gaston
Yura Pismerov
Michael Hill
Dan Lowe=20

ORIGINAL QUESTION
---------------------------------------------------------------------------=
------------------------------------------------------------
On Wed, Oct 03, 2001 at 10:17:43AM +0100, Modrego K. SBD wrote:
>=20
>=20
> 	Hello managers.
>=20
>  Any  body try to do a telnet into a crontab scripts, that gets =
information of stadistics?
>=20
> Ihave anostat runing as service in inet, when i do a telnet to the =
server and port, i recive two lines=20
>=20
> draco:/opt/mrtg-2/cfg#telnet linx 2001
> Trying 172.30.6.6...
> Connected to linx.
> Escape character is '^]'.
>          cpu
>  us sy wt id
>   3  3  2 91
>   9  1  4 86
> Connection closed by foreign host.
>=20
> this is the correcto output executing the comando from the prompt.
>=20
>=20
> and this is the result of redirect the stdout and stderr to a file ..
>=20
> draco:/opt/mrtg-2/cfg#cat /tmp/linx.realtelnet
> Trying 172.30.6.6...
> Connected to linx.
> Escape character is '^]'.
> draco:/opt/mrtg-2/cfg#
>=20
>=20
> if any body know what is happening..  y will be grateful ( and of course =
i will summaryze  :) )
>=20
>=20
> Thanks in advance..
>=20
> And sorry my bad english.
>=20
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>  Kenneth Modrego Pechero
>  SBD Consultors                           =20
>  DNET - Web Server & Middleware=20
>  Sistemas Internet Banco Sabadell
>  Tel: 93.728.2440
>  E-mail: modregok@bancsabadell.com=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
>=20

SOLUTION
---------------------------------------------------------------------------=
------------------------------------------------------------------

Most people says me that are two good options

- Expect
- Perl

Finaly i try to use Perl because is the soft that i have intaled.. and =
some people here programs in perl..

the code.

#!/usr/local/bin/perl

use Net::Telnet;
 $telnet =3D new Net::Telnet ( Timeout=3D>400,
                             Errmode=3D>'die',
                             Port=3D>2001 );
 print $telnet->open($ARGV[0]);
 while ($report =3D $telnet ->getline) {
 print $report;
}

$=20

This code starts a telnet session to the first argument an print the =
output to the stdout.

Its works fine for me.

Thank to all!!
my apologies.. i have a horrible english..  :)

Regards.





=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
 Kenneth Modrego Pechero
 SBD Consultors                           =20
 DNET - Web Server & Middleware=20
 Sistemas Internet Banco Sabadell
 Tel: 93.728.2440
 E-mail: modregok@bancsabadell.com
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
Received on Thu Oct 11 10:17:31 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:33 EDT