Expect script help

Expect script help
Hey,
I am writing an expect script to be called by a ksh script. The expect script as expect will automate ssh login, and check for /var/crash (dump) space on the server, and return a value depending on if space is
enough or not.

#!/usr/bin/expect -f
spawn ssh -o StrictHostKeyChecking=no abc@def
expect "netdump@def's password:"
sleep 1
send "abc\r"
sleep 3
expect ".com"
set result [exec df /var/crash | grep -v Filesystem | grep -v dev | tr -s " " " " | cut -d " " -f4]
puts " the value is $result"

*** The set command shud set result to value of free space on the remote server right ?? But it sets it to the value of free space on the host server. Got no idea why. ***


puts " the value is $result"
send "logout\r"
interact

Any suggestions ?

I want the exec command to compute this on the remote server. Store the value in $result.
I 'll pass an argument to this expect script which is min free space.
I can then compare these two and return 0 if the server has enuf space and 1 if not .

Directions please,
Shrikant

Well, the first direction is - Read the forum rules. No duplicate posts!

Thread closed.