Automating The process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automating The process
# 1  
Old 03-07-2011
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

Code:
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

Last edited by joeyg; 03-07-2011 at 01:08 PM.. Reason: Please use CodeTags around commands
# 2  
Old 03-07-2011
You could install cygwin on your windows box (with openldap and expect) and use an expect script something like this:

Code:
#!/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


Last edited by Chubler_XL; 03-07-2011 at 06:22 PM..
# 3  
Old 03-07-2011
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
# 4  
Old 03-07-2011
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)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automating an interactive process with EOF string

Hello, I'm running Stockfish chess engine ( Home - Stockfish - Open Source Chess Engine ) CLI on Linux in interactive mode which is working fine. root@ubuntu1950x:~# ./stockfish Stockfish 080218 64 POPCNT by T. Romstad, M. Costalba, J. Kiiski, G. Linscott setoption name Debug Log File... (2 Replies)
Discussion started by: prvnrk
2 Replies

2. Shell Programming and Scripting

Automating Mail Process

Hi i had written one script,it sends email from terminal and mine script is as: #!/bin/bash SUBJECT="linux mail send attachment example" BODY_FILE="/home/sreenivasa/Desktop/Testing.txt" #ATTACHMENT_FILE="/home/sreenivasa/Desktop/Dataset.zip"... (23 Replies)
Discussion started by: rajnikant
23 Replies

3. UNIX for Dummies Questions & Answers

Automating the FTP get

Hi , I want to pull files from ftp monthly once . The files in ftp has a something like 292_fileto_pull and next month it will be 293_fileto_pull for each month the number keeps increasing. i thought in my script if i can use date and increment the number by it mget *_292_fileto_pull i... (2 Replies)
Discussion started by: vikatakavi
2 Replies

4. Shell Programming and Scripting

Automating

Hi All, I have a shell script that is integrated with a fault management system. It periodically monitors the system and raises an alarm. This script has different functions and it accepts input from us on the console. Is there any way to invoke it using a shell script ? Please advise. ... (2 Replies)
Discussion started by: praviper
2 Replies

5. UNIX for Dummies Questions & Answers

Automating a process

Could any one tell me , how to start a thread here, i just searching for so long. sorry to post in irrelavent here ---------- Post updated at 08:19 AM ---------- Previous update was at 08:00 AM ---------- Hi, I got a requirement to automate the process. We have SLA files, there are... (1 Reply)
Discussion started by: afahmed
1 Replies

6. Shell Programming and Scripting

Automating scsudo

Solaris... I need to automate running of scsudo from another script. However, I've determined that scsudo reads the password from /dev/tty rather than STDIN when the Password prompt appears. I don't have 'expect' or equivalents available - can I automate sending the correct password when... (1 Reply)
Discussion started by: JerryHone
1 Replies

7. Shell Programming and Scripting

automating daily monitoring process

Hi there, I have to automate daily monitoring process and then the result of these process should be sent to a log file, then this log file should be mailed . ps -ef | grep aa In this atleast one process should run. If the process is running it should mention Success in the log file... (3 Replies)
Discussion started by: NehaKrish
3 Replies

8. Linux

Automating build and test process

Hey ppl, I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this?:confused: (8 Replies)
Discussion started by: laxmi
8 Replies

9. Shell Programming and Scripting

Automating build and test process

Hey ppl, I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this? (0 Replies)
Discussion started by: laxmi
0 Replies

10. Shell Programming and Scripting

automating password ?

Hi all, I want to write a script which logs into a database (DB2). To do this i need to have a password. This will be done lots and lots of times, so i need to modify the script to automate the response to the password request. How do i this, because at present i do the following: db2 connect... (3 Replies)
Discussion started by: Liamo
3 Replies
Login or Register to Ask a Question