rlogin via expect mysteriously aborts when run from cron



Hello, and sorry for crossposting. I'm not sure whether this is a problem related to shell, or to expect.

I have an application which, at some point, executes a zsh script. This
script in turn calls another script written in Tcl/Expect, and that one
does an rlogin to a remote host, does some interaction, and then returns.
Note also that the login-shell on the remote host is tcsh. The operating
system on both machines is Linux.

All this works fine when called manually, but when running it from a
cron job, it mysteriously dies within the rlogin thing.

So the first thing I did was to put a "set echo" in the .cshrc on
the remote system to see at which point the application dies.

When investigating the output which was sent to me from the cron job
via email, I found that on several runs, it died on different points
while executing .cshrc (in this case, there is a *lot* to do in .cshrc,
as there are MANY other scripts sourced). Moreover, it does not die
with an error message; instead, it is that someone "just has cut the
plug" during execution. I had one case where even a command

setenv VAR something

was listed only "half" in the cron job, as

setenv VAR som

In another case, the system was able to perform the whole login
process, Expect was even able to supply the first command as part
of the interaction, but the next command, which happened to be
a cd $HOME, was only listed, but I already didn't see the shell
prompt, so the connection must have been cut after this.

There were also no other output from my script after that.

So what could be the reason for this strange behaviour? Could
there be some kind of timeout be involved, which kills the
connection? Alternatively, could it be that cron collects output
only up to a certain amount, and if the application produces
more, it is killed?

The last one would explain why sometimes the commands seem to
be "cut in the middle"; due to the complexity of the rlogin
stuff, it is well possible that on successive invocations,
always a different amount of output is produced. OTOH, the man
pages for cron don't mention such a restriction.

Any ideas on this?

Ronald

--
Ronald Fischer <ronaldf@xxxxxx>
Posted via http://www.newsoffice.de/

.



Relevant Pages

  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.shell)
  • Re: cd.exe
    ... hopefully will use the value of SHELL to invode the command. ... sets up the build environment and invokes bash. ... The script translates ... when invoked from the script though works fine from the command line. ...
    (comp.os.os2.programmer.porting)
  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... I can write and compile ... >>programs inside a shell, ... But for me it is essential, that the script ... > internal command), the this script can be executed even if there ...
    (alt.lang.asm)
  • Re: Script to extract portions of text from a text file
    ... > But your example is not comparing the same command. ... it wouldn't be sent to the shell until you press enter). ... >> behaves differently in a script and at the prompt ... While awk does: ...
    (comp.unix.shell)