Script to login to attached SUN Storage through Solaris m/c w/o user intervention


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to login to attached SUN Storage through Solaris m/c w/o user intervention
# 1  
Old 04-20-2009
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
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To ask for user intervention

hi guys i want my cron to execute for every minute (5 Replies)
Discussion started by: azherkn3
5 Replies

2. Shell Programming and Scripting

How to write a shell script to automatically accept return key with out user intervention?

Hi Friends, i am creating a shell script which is accepting file name as input parameter from Java and invoking finacle service. The service will accpet text file,B2k_session id,etc and upload the text file data in finacle database. My shell script looks like this:- #! /bin/ksh... (2 Replies)
Discussion started by: vadlamudy
2 Replies

3. Solaris

How to differ local disks from attached from storage ones?

Hello. I have a solaris box with several local disks and several come from SYMMETRIX storage. Is there any way to tell format (or other util) to show only local disks? (6 Replies)
Discussion started by: urello
6 Replies

4. Shell Programming and Scripting

How to use ssh command in the shell script without user intervention?

Hello All, I need your help, i would like to know how to use ssh command in the shell scripts? and make the script continue to enter the password without user intervention example of the normal commands written manually: # ssh 172.30.1.256 -l mxread password: mxread Thanks in advance (3 Replies)
Discussion started by: Dendany83
3 Replies
Login or Register to Ask a Question
chsh(1) 						      General Commands Manual							   chsh(1)

NAME
chsh - change default login shell SYNOPSIS
login-name [shell] login-name [shell] login-name [shell] login-name [shell] DESCRIPTION
The command changes the login-shell for a user's login name in the repository (see passwd(1)). The DCE repository is only available if Integrated Login has been configured; see auth.adm(1M). If Integrated Login has been configured, other considerations apply. A user with appropriate DCE privileges is capable of modifying a user's shell; this is not dependent upon superuser privileges. If the repository is not specified (as in [login-name]), the login shell is changed in the file only. Run after running to make sure the information was processed correctly. Notes The command is a hard link to the command. When is executed, actually the command gets executed with appropriate arguments to change the user login shell in the repository specified in command line. If no repository is specified, the login shell is changed in the file. Arguments login-name A login name of a user. shell The absolute path name of a shell. If the file exists, the new login shell must be listed in that file. Otherwise, you can specify one of the standard shells listed in the getusershell(3C) manual entry. If shell is omitted, it defaults to the POSIX shell, Options The following option is recognized: Specify the repository to which the operation is to be applied. Supported repositories include and Security Restrictions You must have appropriate privileges to use the optional login-name argument to change another user's login shell. NETWORKING FEATURES
NFS File can be implemented as a Network Information Service (NIS) database. EXAMPLES
To change the login shell for user to the default: To change the login shell for user to the C shell: To change the login shell for user to the Korn shell in the DCE registry: WARNINGS
If two or more users try to write the file at the same time, a passwd locking mechanism was devised. If this locking fails after subse- quent retrying, terminates. AUTHOR
was developed by HP and the University of California, Berkeley. FILES
SEE ALSO
chfn(1), csh(1), ksh(1), passwd(1), sh(1), sh-posix(1), getusershell(3C), pam(3), passwd(4), shells(4). chsh(1)