Hi

I have not done a lot with Expect, but I am hoping someone can figure if I am doing something that should not be done here or if I am misusing cron.

I have written an expect script to extract info from a non-snmp capable device.

The expect script logs into my target via ssh , runs a few commands here and there, gets usage, users, active sessions and so on and quits.

When I run it it works fine, grabbing the info I need.
I can also then pipe to tee and it captures in a file for me.
This all seems to work well.

I then try and be a smarty pants and place it in cron to run twice every hour
I have a few of these scripts to a few devices so have a few more entries in cron, but here is one example.

Code:
8,38 * * * * $HOME/scripts/script.exp | tee -a $HOME/stats/`date +\%H\%M_\%m\%d_\%Y_device`.log 2>&1

The file is created.
However, Im seeing some files truncated like the thing quits before its done.
I would think its a timing or matching thing in expect, but this only happens when I place in cron
I tried placing in sleeps and different expect criteria but it always stops at the same point.


Am I misusing expect or cron here? Is there something I am not doing in Cron that I should be doing? Is there something in my statement that wrong? Is it some idiosyncrasy with cron I'm not aware of?



Thanks a mill

jonobr

PS 10.04 LTS , and now as I write, Im thinking of upgrading just to see if its that!