LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-06-2010, 12:15 AM   #1
aditi
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Rep: Reputation: 0
Question how to automate an installation script suppressing user interaction


Hello All,

Im new to linux and this is my first post...

Im working on ubuntu and i need to install glassfish on my machine often. I want to write a script which can automate this installation and the post installation work so that I can run this script when i leave office and have everything done by the time I reach office the next day.

But after running the installation command there will be a license agreement which i need to accept by typing "A" at the console. Now How I can automate this so that the scipt can take this from a txt file? Please help.....


mv /home/liferay-portal-glassfish-linux-5.2.3.jar /opt/argon/
cd /opt/argon
java -Xmx256m -jar liferay-portal-glassfish-linux-5.2.3.jar

<Here The console expects to type "A" accepting the lisence agreement>

cd glassfish
chmod -R +x lib/ant/bin
......
....
....
...
linuxubuntu aditi is online now
Tag This Post No tags yet, please tag this post - what is this?
Your Tags:
Edit/Delete Message Reply With Quote
aditi
View Public Profile
View LQ Blog
View Bookmarks
View Review Entries
View HCL Entries
Find More Posts by aditi
Add aditi to Your Contacts

Reply
 
Old 02-06-2010, 12:22 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by aditi View Post
Hello All,

Im new to linux and this is my first post...

Im working on ubuntu and i need to install glassfish on my machine often. I want to write a script which can automate this installation and the post installation work so that I can run this script when i leave office and have everything done by the time I reach office the next day.

But after running the installation command there will be a license agreement which i need to accept by typing "A" at the console. Now How I can automate this so that the scipt can take this from a txt file? Please help.....


mv /home/liferay-portal-glassfish-linux-5.2.3.jar /opt/argon/
cd /opt/argon
java -Xmx256m -jar liferay-portal-glassfish-linux-5.2.3.jar

<Here The console expects to type "A" accepting the lisence agreement>

cd glassfish
chmod -R +x lib/ant/bin
......
....
....
...
linuxubuntu aditi is online now
Tag This Post No tags yet, please tag this post - what is this?
Your Tags:
Edit/Delete Message Reply With Quote
aditi
View Public Profile
View LQ Blog
View Bookmarks
View Review Entries
View HCL Entries
Find More Posts by aditi
Add aditi to Your Contacts

Reply
Try

Code:
yes A | java -Xmx256m -jar liferay-portal-glassfish-linux-5.2.3.jar
(
and read

man yes
).

This may or may not work - depending how the Java part is implemented, but in the simplest/luckiest for you case it will work.
 
Old 02-08-2010, 11:43 PM   #3
aditi
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Smile

Works Charmingly....... Thank u.......

But lets say my script expects a username and password to type in then how to automate their typing?

For example I need to make a VPN connection and I write a script as following to automate this

cd
cd Desktop/oncology_project/vpnclient/
sudo ./vpnclient_init start

<Here the SUDO expects the root password to be typed>

sudo ./vpnclient connect USONCOLOGY-VPN

<Here the username and password for the vpn connection has to be typed>

How to Automate this Whole process? I have heard of the "expect" command but how to use it in this situation...???? Pls help

Last edited by aditi; 02-09-2010 at 01:00 AM. Reason: Need to get help for complex situation
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to automate an installation script suppressing user interaction aditi Linux - Newbie 1 02-06-2010 05:56 AM
needed help in ruby script where user interaction is necessary? wrapster Programming 10 08-08-2008 01:50 AM
Needed help in a ruby script with user interaction involved! wrapster Solaris / OpenSolaris 2 08-06-2008 10:47 PM
How to program shell script to automate mass user account creation? EsAsher Linux - General 2 06-30-2007 08:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration