Automating The process

Hi Guru's,

I am trying to write a scripts that will automate my image provisoining process.

Scenario:

I have Linux Image Hosted on cloud which needs to be provisoned before it can be used. Currently we log onto the image through the putty on windows and connect to linux instance. I login as root then a scipt which runs as part of .profile of root user asks for certain inputs from the user which are as follows:
Accept License Agreemnet : (y/n)
New Password for user root:
New password for user xyx :

I just do not want to connect to each instance and enter the required values. I just wanted to enter the parameter as commandline input. what I tried was below

c:\putty.exe -load "session name in putty" -l root  -m c:\putty1.txt

c:\putty1.txt contains the parameters y,password for users.

the issue is that this values from input file are passed on to shell before prompted for causing the script to terminate.

Any help on this will be helpful.

Arshad

You could install cygwin on your windows box (with openldap and expect) and use an expect script something like this:

#!/usr/bin/expect
spawn /bin/ssh -l myusername -p myport myhostname.abc.com
expect {
    "Accept License Agreement" { send "Y\r" }
    timeout { puts "Connection failed"; exit }
}
expect "New Password for user root:"
send "myrootpass\r"
expect "New Password for user xyx:"
send "myXYXpass\r"
expect -re "#|\$"
send "exit\r"
expect eof

Thank you Chubler_XL , I did install cygwin but there was no expect,send command found in the path specified. Is there anything else that needs to be done on my part.

I installed the latest version form cygwin site.

Arshad

yes when you install you need to select expect (not installed by default), from the "Select packages" screen expand "Interpreters" and then select "expect", also install Net->ssh (or Net->inetutils if you use telnet)