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-02-2010, 09:11 AM
hadi motamedi
 
Default How to schedule for a repeated task?

Dear All
I need to schedule for a repeated task on my Debian 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
 
Old 05-02-2010, 10:46 AM
 
Default How to schedule for a repeated task?

On Sun, May 02, 2010 at 10:11:43AM +0100, hadi motamedi wrote:
> Dear All
> I need to schedule for a repeated task on my Debian 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

Hello,

For that task, you want expect.
To schedule it, you need cron.

Regards.

--
Huella de clave primaria: 0FDA C36F F110 54F4 D42B D0EB 617D 396C 448B 31EB
 
Old 05-02-2010, 11:44 AM
Om Prakash
 
Default How to schedule for a repeated task?

On Sunday 02 May 2010 04:16 PM, d.sastre.medina@gmail.com wrote:

On Sun, May 02, 2010 at 10:11:43AM +0100, hadi motamedi wrote:


Dear All
I need to schedule for a repeated task on my Debian 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


Hello,

For that task, you want expect.
To schedule it, you need cron.

Regards.



yes expect will help better to achieve telnetting part.

you can either use at or cron to schedule it.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4BDD65AD.6080403@gmail.com">http://lists.debian.org/4BDD65AD.6080403@gmail.com
 
Old 05-03-2010, 12:16 AM
Jobst Schmalenbach
 
Default How to schedule for a repeated task?

On Sat, May 01, 2010 at 07:12:54AM -0400, Jim Perrin (jperrin@gmail.com) wrote:
> On Sat, May 1, 2010 at 5:52 AM, hadi motamedi <motamedi24@gmail.com> wrote:

[snip]

> Several things are wrong with this:
>
> 1. DO NOT EVER USE TELNET.

<just to be picky ;-)>

While I 100% agree with this you need to refine the wording a little

> 1. DO NOT EVER USE TELNET TO LOGIN.

Telnet is still a VERY VERY worthy tool to debug e.g. a
mail/imap/pop/whatever conection and I would not want
to live without it, even for HTTP connections, the only
thing you need to know is the protocol you want to debug.

telnet mail.domain.ext 25

If you establish a sucessful connection you will see something like
Connected to mail.domain.ext.
Escape character is '^]'.
220 domain.ext ESMTP MDaemon 6.7.6; Tue, 25 Mar 2003 11:37:02 +0000

The next step is to tell the mail server where you are mailing from.
This is the FQDN or the IP address of your local machine
HELO local.domain.name

A well configured mail server will check you are who you say you are
(so, if you lie about your machine FQDN or IP, you may well caught), then respond
250 mail.domain.ext Hello local.domain.name [a.b.c.d], pleased to meet you

Next you specify who the mail is from
MAIL FROM: mail@domain.ext

which should return
250 2.1.0 mail@domain.ext... Sender ok

Some mail servers will check that the domain you use in the MAIL FROM: command exists.

Now tell the mail server who the email is to
RCPT TO: mail@destinationdomain.ext

which should return
250 2.1.0 mail@destinationdomain.ext... Recipient ok

Now tell the mail server that you are going to send the email
DATA

Now you can start writing your email.
Start by entering the email headers.
Note the space between the : terminating the header name and the value. This is mandatory.
From: Your Name
To: Their name
CC: Someone else
Subject: Your subject.

Once you finished with your header, press enter to leave a blank
line before you begin the message body, then enter your email contents.
To tell the mail server that you have completed the message enter a single "." on a line on its own.

The mail server should reply with something like
250 2.0.0 OK Message saved for delivery

You should close the connection by issuing the QUIT command. The mailserver should sign off with something like:
221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.


</just to be picky ;-)>

Jobst



> Seriously. Don't do this. It sends your user/pass in plain text. It's
> a horrendous security risk. I don't care what excuse you have to try
> to defend it. DO NOT DO IT. Use ssh keys instead.
>
> 2. Use ssh keys instead of setting a password in the script.
>
> 3. You don't need to use expect to set the PWD to /tmp. You can do
> this with basic scripting. Pick up a bash scripting guide and read
> through it. I see almost nothing in your example that requires expect.
> This can be done with a simple bash script.
>
>
>
>
> --
> During times of universal deceit, telling the truth becomes a revolutionary act.
> George Orwell
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos




--
Tommorow or the next life, whichever comes first, we never know. - Saying from Tibet.

| |0| | Jobst Schmalenbach, jobst@barrett.com.au, General Manager
| | |0| Barrett Consulting Group P/L & The Meditation Room P/L
|0|0|0| +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 10:03 AM
John Doe
 
Default How to schedule for a repeated task?

From: hadi motamedi <motamedi24@gmail.com>
>Actually I need to telnet to it and issue some commands and capture the output of the commands in a file and then wait for a prescribed time interval and then redo from the start (but I need to append all of the logs in just one file).

Maybe have a look at nc (man nc)...

JD



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 11:02 AM
hadi motamedi
 
Default How to schedule for a repeated task?

Maybe have a look at nc (man nc)...



Thank you . It can connect to remote node port 23. But how can I send command to remote node and capture its log?



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 11:09 AM
"John R. Dennison"
 
Default How to schedule for a repeated task?

On Mon, May 03, 2010 at 12:02:43PM +0100, hadi motamedi wrote:
> > Thank you . It can connect to remote node port 23. But how can I send
> command to remote node and capture its log?

Do you do a single iota of research on your own or do you
expect the members of this list to do *everything* for you?

There are man pages ("man nc"); documentation (located in
/usr/share/doc/nc-1.84) and google.

Can you please make an effort to help yourself on occasion?
You will learn more and you won't alienate members of the list.

I'm extremely sorry if this comes across as rude, but quite
frankly I find your lack of research and your wasting the
time of the readers of this list quite rude.




John

--
If you can give your son or daughter only one gift, let it be enthusiasm.

-- Bruce Barton (1886-1967), American author, advertising expert
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 11:42 AM
hadi motamedi
 
Default How to schedule for a repeated task?

* * ** Do you do a single iota of research on your own or do you


* * * *expect the members of this list to do *everything* for you?






Sorry for wrong question. I just need to know if you see implementing it via 'expect' or 'nc' is feasible or not? I you see it feasible, I will extract the details by myself.Please let me know.





_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 12:45 PM
Les Mikesell
 
Default How to schedule for a repeated task?

hadi motamedi wrote:
>
>
> Do you do a single iota of research on your own or do you
> expect the members of this list to do *everything* for you?
>
>
>
> Sorry for wrong question. I just need to know if you see implementing it
> via 'expect' or 'nc' is feasible or not? I you see it feasible, I will
> extract the details by myself.Please let me know.

The nature of unix tools is that you can make about anything work if you use the
shell to glue in missing functionality with some other tool. nc by itself would
be better at bulk network transfers while expect would be better at interactive
chatting where you need to parse the output from the other side. With perl's
Net::Telnet module you'd have a good tool for the chat plus a complete
programing language around it.

But, I'll repeat the advice to use something based on ssh if the other end is a
computer - and if you are moving files around, use rsync over ssh.

--
Les Mikesell
lesmikesell@gmail.com


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-03-2010, 06:49 PM
"Kevin Ross"
 
Default How to schedule for a repeated task?

> From: d.sastre.medina@gmail.com [mailto:d.sastre.medina@gmail.com]
> Sent: Sunday, May 02, 2010 3:47 AM
>
> On Sun, May 02, 2010 at 10:11:43AM +0100, hadi motamedi wrote:
> > Dear All
> > I need to schedule for a repeated task on my Debian 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
>
> Hello,
>
> For that task, you want expect.
> To schedule it, you need cron.
>
> Regards.

Yes, expect will work, but if you can use ssh, use it, it will be easier.
Setup ssh to use RSA key for authentication, so it won't prompt for a
password. Then just execute "ssh username@remote.server somecommand" and it
will run "somecommand" and the output will be sent back to you.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 015501caeaf1$5e206640$1a6132c0$@net">http://lists.debian.org/015501caeaf1$5e206640$1a6132c0$@net
 

Thread Tools




All times are GMT. The time now is 04:58 AM.

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