Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 May 2001 11:45:18 -0400
From:      "Simon" <simon@optinet.com>
To:        "David Wilson" <davew@sai.co.za>, "freebsd-isp@freebsd.org" <freebsd-isp@freebsd.org>
Subject:   Re: Telnet + command scripting run from  crond
Message-ID:  <20010514154055.630E737B423@hub.freebsd.org>
In-Reply-To: <NEBBJFIIGKGLPEBIJACLAEDODMAA.davew@sai.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
--_=_=_=IMA.BOUNDARY.HTML_4963808=_=_=_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

There are many ways, here is one right out of Net::Telnet manual:

           use Net::Telnet ();
           $t = new Net::Telnet (Timeout => 10,
                                 Prompt => '/bash\$ $/');
           $t->open("sparky");
           $t->login($username, $passwd);
           @lines = $t->cmd("/usr/bin/who");
           print @lines;

perldoc Net::Telnet for more info, if you don't have it installed, install it.

-Simon

--Original Message Text---
From: David Wilson
Date: Mon, 14 May 2001 17:38:52 +0200

Hi all, howzit going ?
 
I'm not to good at scripting so I really need help on this:
I have a USR NAS device that I need to telnet every 24 hrs and issue a command to 
it, how could I write a script that I could run as a cron job that would automatically 
login and issue the commands and then log out again ?
Thanks.
Any help would be greatly appreciated.
 


Regards 

David Wilson 

Technical Support Centre 

The S.A Internet 

0860 100 869 

http://www.sai.co.za  




--_=_=_=IMA.BOUNDARY.HTML_4963808=_=_=_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit

<HTML>

<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE">There are many ways, here is one right out of Net::Telnet manual:<BR>
<BR>
           use Net::Telnet ();<BR>
           $t = new Net::Telnet (Timeout =&gt; 10,<BR>
                                 Prompt =&gt; '/bash\$ $/');<BR>
           $t-&gt;open("sparky");<BR>
           $t-&gt;login($username, $passwd);<BR>
           @lines = $t-&gt;cmd("/usr/bin/who");<BR>
           print @lines;<BR>
<BR>
perldoc Net::Telnet for more info, if you don't have it installed, install it.<BR>
<BR>
-Simon<BR>
<BR>
--Original Message Text---<BR>
<B>From:</B> David Wilson<BR>
<B>Date:</B> Mon, 14 May 2001 17:38:52 +0200<BR>
<BR>
<FONT FACE="Verdana"><FONT SIZE="2" POINTSIZE="10">Hi all, howzit going ?<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"><BR>
 <BR>
<FONT FACE="Verdana"><FONT SIZE="2" POINTSIZE="10">I'm not to good at scripting so I really need help on this:<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"><BR>
<FONT FACE="Verdana"><FONT SIZE="2" POINTSIZE="10">I have a USR NAS device that I need to telnet every 24 hrs and issue a command to it, how could I write a script that I could run as a cron job that would automatically login and issue the commands and then log out again ?<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"><BR>
<FONT FACE="Verdana"><FONT SIZE="2" POINTSIZE="10">Thanks.<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"><BR>
<FONT FACE="Verdana"><FONT SIZE="2" POINTSIZE="10">Any help would be greatly appreciated.<FONT FACE="MS Shell Dlg" DEFAULT="FACE"><FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"><BR>
 <BR>
<BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">Regards<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"> <BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">David Wilson<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"> <BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">Technical Support Centre<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"> <BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">The S.A Internet<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"> <BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">0860 100 869<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE"> <BR>
<BR>
<FONT SIZE="2" POINTSIZE="10">http://www.sai.co.za<FONT SIZE="1" POINTSIZE="8" DEFAULT="SIZE">  <BR>
<BR>
<BR>

</HTML>


--_=_=_=IMA.BOUNDARY.HTML_4963808=_=_=_--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010514154055.630E737B423>