FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 05-01-2010, 09:10 AM
hadi motamedi
 
Default How to schedule for a repeated task?

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




_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-01-2010, 09:14 AM
Athmane Madjoudj
 
Default How to schedule for a repeated task?

On Sat, May 1, 2010 at 10:10 AM, hadi motamedi <motamedi24@gmail.com> 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

Use cron to schedule the tasks.

if you need to automate an interactive command you can use expect [1][2]

[1] http://expect.nist.gov/
[2] http://en.wikipedia.org/wiki/Expect


HTH

--
Athmane Madjoudj
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-01-2010, 09:52 AM
hadi motamedi
 
Default How to schedule for a repeated task?

if you need to automate an interactive command you can use expect [1][2]


Thank you for your reply. I am trying like the followings:
#expect
>set name 172.16.17.160
>set user id
>set password pwd
>set cmd1 "cd /tmp"
>set cmd2 "cp log.cap /export/home"

>set cmd3 "logout"
>spawn telnet $name
>expect "login:"
>send "$user"
>expect "Password:"
>send "$password"
>send "$cmd1"

>send "$cmd2"
>send "$cmd3"
>exit
I don't see any error when executing, but at the end no file is being copied. Can you please correct me?
Thank you





_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 12:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org