Red Hat expect script failure

I am downloading a script to BigFix clients and running it. It’s expect and expect is installed on the client. However, I get a return code of 0 in the log but he script doesn’t run properly or something. It works from the command line.

This is the command in Big Fix
wait /bin/sh --login -c “/var/opt/BESClient/__BESData/actionsite/__Download/tsmCache.exp {parameter “TSMPassword” of action}”

The script works outside of big fix

This is what it does

#!/usr/bin/expect -f

set password [lindex $argv 0]

spawn /bin/dsmc q sched

expect ">: " {send “\r”}

expect ": " {send “$password\r”}

interact

Any ideas?

Are you enabling execute permissions on the script after you download it (i.e. chmod +x) ?

Yes, that part works fine.

see this response … it does has the expect script code embeded in it.

You might try redirecting the output (though honestly I’m not sure whether that itself would interfere with expect)

wait /bin/sh --login -c “/var/opt/BESClient/__BESData/actionsite/__Download/tsmCache.exp {parameter “TSMPassword” of action} >/tmp/output.txt 2>&1”

That may show if some kind of error is being encountered. I wonder whether dsmc is dependent upon some environment variable that isn’t being defined in the shell.

Thank you Jason for your help.

you can turn on expect in debug mode and enbale the expect logs. dsmc is TSM client backup/restore utility. we have used to before when we were using the TSM backup now we are at EMC networker.

#!/usr/bin/expect -d
log_file /tmp/logs.exp

“>” might not work. You have to put that expression in the wrapper script for redirection.

besclient logs might have some details why its not runing. and expect log can also shed some light on that.

Thanks for that, I will take a look at the debug. In the log files, it runs fine, doesn’t find an error.

Thanks!