04-20-2009
1,
0
Join Date: Apr 2009
Last Activity: 21 April 2009, 2:58 AM EDT
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
Script to login to attached SUN Storage through Solaris m/c w/o user intervention
I want to create a shell script to CLI login to attached SUN 6140 storage from Sun Solaris 9 m/c (instead of using CAM )
but that prompts me for password despite the fact that i am adding them in script .. i am using "expect" feature for this .. however as i never used "expect " before .. so requesting you guys to suggest ..
Below in my example script . (may have many errors ;-) )
[12:57pm] root@dwsmum1: # cat storage_disk_check_script_old.sh
#!/usr/local/bin/expect
set PASSWD=crscp6
echo "##### Check for Storage Disk Status #####\n"
# /opt/se6x20/cli/bin/sscs login -h localhost -u root
spawn /opt/se6x20/cli/bin/sscs login -h localhost -u root
expect {
Type your password: { send "$PASSWD\r" }
}
for i in `/opt/se6x20/cli/bin/sscs list array | awk '{print $2}'` ;
do /opt/se6x20/cli/bin/sscs list -a $i disk | grep -i Failed > /dev/null;
if [ $? = 0 ] ; then echo " Disk in Storage Array $i Failed " ;
else echo " All Disks in Storage Array $i Enabled " ;
fi ;
done
exit
*******
expected result ::
it will not prompt me as "Type your password:" instead take password from script and follow the instructions and quit ..
Thanks in Advance ..
/Yogesh