On Sat, May 1, 2010 at 10:52 AM, Les Mikesell <firstname.lastname@example.org> wrote:
> hadi motamedi wrote:
>> Dear All
>> I need to schedule for a repeated task on my CentOS server, as the
>> -) Telnet to a remote node
>> -) Issue a command
>> -) Capture the output in a log
>> -) Logout from Telnet
>> -) Wait for a prescribed time interval
>> -) Then redo , but append the subsequent output in just on file
>> Can you please let me know which options do we have to write such a task?
>> Thank you
> If the remote end of this is some dumb device that can only do telnet, use
> expect, kermit, or perl's Net::Telnet module to chat with it. *If it is another
> computer, set up ssh keys and just run remote commands directly. *And use cron
> to schedule the runs.
Yah, perl would be easiest:
use Net::Telnet ();
$username = "fred";
$passwd = "fredspassword";
$server = new Net::Telnet (Timeout => 10, Prompt =>
@lines = $server->cmd("hostname ");
That's almost unchanged from the example in cpan's Net::Telnet..
CentOS mailing list