On Sat, May 1, 2010 at 10:52 AM, Les Mikesell <lesmikesell@xxxxxxxxx> wrote: > hadi motamedi wrote: >> Dear All >> I need to schedule for a repeated task on my CentOS server, as the >> followings: >> -) 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 => '/\\[fred\\@vm\\-helios-005 \\~\\]\\$/'); $server->open("vm-helios-005"); $server->login($username, $passwd); @lines = $server->cmd("hostname "); print @lines; That's almost unchanged from the example in cpan's Net::Telnet.. :) _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos