[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to schedule for a repeated task?



On Sun, May 09, 2010 at 12:04:58AM -0700, hadi motamedi wrote:
> I modified my script , as attached,
> according to your comment but it still needs manually issuing Ctrl-C
> at end.

Is your script always launched from tmp?
That is what you _exactly expect_:

send -- "logout\r"
expect -exact "
Connection closed by foreign host.\r\r
\[root@gprs tmp\]# "    <------------------------------------
send -- "exit\r"
expect eof

If that's not the case, you should modify it accordingly.
Please read the comments generated by autoexpect regarding timing and
differing output. Try setting force_conservative to 1 and/or use
regexp in the expected patterns. Try the simplest expect script, i.e, one 
that only logs in and logs out.
In your initial post, you said you needed to store the output
somewhere, have you tried log_file?

You don't mention a single trial-error on your side.
Be warned that this community enjoys helping those who help themselves
first. It's been suggested to try a tool and a manpage. I know expect
looks weird at first, so autoexpect was suggested to ease the curve.
But don't expect to be said exactly what to do (pun).

Regards.

-- 
Huella de clave primaria: 0FDA C36F F110 54F4 D42B  D0EB 617D 396C 448B 31EB

Attachment: pgp7zDzz6IJ9j.pgp
Description: PGP signature


Reply to: