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
---------- Post updated 07-08-09 at 09:43 AM ---------- Previous update was 07-07-09 at 11:09 AM ----------
Wow, mr murphy.
you could have spent the time closing that post, and shooting a smart reply, by instead answering the post for which the forum is actually for.
Even after you knew it was my first post, and obviously an inadvertent mistake.
Geez.