Re: how to expect a string



Atropo wrote:
this was posted on comp.unix.admin as a mistake.

Sorry, maybe the subject was somehow vague.
what I want is .

I had a process (proc1) with that writes to a log. when this
process
came up it writes a "ready" on the log , about 1 or 2 mins later. I
would like to raise another instance (proc2), check the log and wait
for the "ready" string, then kill the old proc1. don't know how to
get
out of "tail -f log|grep ready" when it appears. I treated with
"expect" but culdn't find an easy help on it, and to be honest don't
understand a bit of it. Hope you give me some advice or better
approach.

You could do something like this:

proc1 > log &
pid=$!
while [ -n "$pid" ]
do
sleep 1
grep "ready" log &&
kill [-whatever] "$pid" &&
pid=""
done

Regards,

Ed.
.



Relevant Pages

  • how to expect a string
    ... this was posted on comp.unix.admin as a mistake. ... maybe the subject was somehow vague. ... I had a process (proc1) with that writes to a log. ... Hope you give me some advice or better ...
    (comp.unix.shell)
  • How to expect a string on a log file
    ... maybe the subject was somehow vague. ... I had a process (proc1) with that writes to a log. ... "expect" but culdn't find an easy help on it, and to be honest don't ... Hope you give me some advice or better ...
    (comp.unix.questions)
  • Re: how to expect a string
    ... then kill the old proc1. ... Ed.- Ocultar texto de la cita - ...
    (comp.unix.shell)