Mailing List Archive

Commandline test to see if a serial connection is up
My Digi serial hub seems to be screwing up on me. So I want to write a
simple script that tests the serial connection of all the servers that I
manage. Here's my question:

Is there any way from commandline to send a carriage return to a console
and see if I get some sort of response back? I can write a script to
handle the details, but I just want to know if I can execute read/write
commands to the "console" program from commandline so I can put it in a
script.

- Steve
Re: Commandline test to see if a serial connection is up [ In reply to ]
On Tue, 2005-04-26 at 18:50, Stever wrote:
> Is there any way from commandline to send a carriage return to a console
> and see if I get some sort of response back? I can write a script to
> handle the details, but I just want to know if I can execute read/write
> commands to the "console" program from commandline so I can put it in a
> script.

Look for a package called "expect"; it's great for scripting this sort
of thing.

- Bill
Re: Commandline test to see if a serial connection is up [ In reply to ]
you can also do very simple things like:

(echo '^M^Ec.'; sleep 4) | console foo > output

at least, it worked the last time i tried it. obviously, it's less than
elegant. probably only really useful for quick command-line hacks. for
anything serious or reliable, do what bill said and use something like
expect.

Bryan

On Tue, Apr 26, 2005 at 08:08:15PM -0400, Bill Sommerfeld wrote:
> On Tue, 2005-04-26 at 18:50, Stever wrote:
> > Is there any way from commandline to send a carriage return to a console
> > and see if I get some sort of response back? I can write a script to
> > handle the details, but I just want to know if I can execute read/write
> > commands to the "console" program from commandline so I can put it in a
> > script.
>
> Look for a package called "expect"; it's great for scripting this sort
> of thing.