expect script in cron

I wrote a script using 'expect' tool to change the password of my login id, every fortnight. And I had put it as a cron job.

The cron job is throwing an error

ld.so.1: /usr/local/bin/expect: fatal: libtcl8.3.so: open failed: No such file or directory

The environment variables are set properly with the paths.

Why is that I still get this error?

When I run the same script in command prompt, I dont get the error...I get the desired result.

Thanks

Type the 'set' command at the prompt and put the ouput in the script. See if it runs successfully during it's next scheduled occurrance. If it does, then it is an environment variable (which is my guess). Most likely it is the LD_PATH (or similar) variable. You can start eliminating variables until you figure out which one is the critical one.

I exported the LD_LIBRARY_PATH environment variable in a shell script, and invoked the expect script from the same script. The shell script was scheduled as cron job. It worked!

But I am facing yet another problem in the expect script. I am calling 'mkpasswd' command(which, in turn, is an expect script) from my expect script.

set NEWPASSWD [exec mkpasswd -d 2 -l 6 -s 0 -C 0]

It says "mkpasswd not found". How else can I store the output of 'mkpasswd' command in a variable?

Thanks

Are you able to put the entire path to mkpasswd in there?

set NEWPASSWD [exec /usr/bin/mkpasswd -d 2 -l 6 -s 0 -C 0]

Be sure to replace the above with the real path to your mkpasswd.

Yes Livinfree

I tried using the absolute path of mkpasswd...and I get the following error:

/usr/local/bin/mkpasswd: expect: not found
while executing
"exec /usr/local/bin/mkpasswd -d 2 -l 6 -s 0 -C 0"
invoked from within
"set NEWPASSWD [exec /usr/local/bin/mkpasswd -d 2 -l 6 -s 0 -C 0]"

I get this problem only when I execute the script as a cron job....from a command prompt, it works fine.