From owner-freebsd-isp Mon May 14 8:40:59 2001 Delivered-To: freebsd-isp@freebsd.org Received: from anaconda.acceleratedweb.net (anaconda.acceleratedweb.net [209.51.164.130]) by hub.freebsd.org (Postfix) with SMTP id 630E737B423 for ; Mon, 14 May 2001 08:40:55 -0700 (PDT) (envelope-from simon@optinet.com) Received: (qmail 39234 invoked by uid 106); 14 May 2001 15:40:56 -0000 Received: from 66-65-36-21.nyc.rr.com (HELO sharky) (66.65.36.21) by anaconda.acceleratedweb.net with SMTP; 14 May 2001 15:40:56 -0000 From: "Simon" To: "David Wilson" , "freebsd-isp@freebsd.org" Date: Mon, 14 May 2001 11:45:18 -0400 Reply-To: "Simon" X-Mailer: PMMail 2000 Professional (2.10.2010) For Windows 2000 (5.0.2195) In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_=_=_=IMA.BOUNDARY.HTML_4963808=_=_=_" Subject: Re: Telnet + command scripting run from crond Message-Id: <20010514154055.630E737B423@hub.freebsd.org> Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --_=_=_=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 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=_=_=_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message