#1  
Old 15th June 2006, 17:06
PortMan PortMan is offline
Member
 
Join Date: Jun 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default batch file or somethng???

I'm new to Linux. I have several commands that need to be entered one at a time to install packages and get them configured. For example:

Code:
yum install bind-chroot
hmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/
cd /var/named/chroot/var/named/
ln -s ../../ chroot
chkconfig --levels 235 named on
/etc/init.d/named start
In the old DOS world, I could make a batch file that would automatically run these commands. Is it possible to do this in Linux? If so, how? As I stated, I'm new to Linux, so good instructions would be great!!

Thanks for your help.
Reply With Quote
Sponsored Links
  #2  
Old 15th June 2006, 17:29
PortMan PortMan is offline
Member
 
Join Date: Jun 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out how to do a "Shell Script" and made it work. But, now I want to findout how to make an answer of "y" automatically.
For example, I have a shell script called "myinstall" which has the following:

yum install mysql mysql-devel mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

It requires me to type "y" to install the package. Is there a way to make it automatically type "y" and continue without human intervention?

Thanks.
Reply With Quote
  #3  
Old 15th June 2006, 18:28
jimjawn jimjawn is offline
Junior Member
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Shell Script & Yum

Portman,

Yum uses a series of "switches" that you can add to the yum command. You can view this in your terminal by entering yum --usage

Usage: yum [options] <update | upgrade | install | info | remove | list |
clean | provides | search | check-update | groupinstall | groupupdate |
grouplist >

Options:
-c [config file] - specify the config file to use
-e [error level] - set the error logging level
-d [debug level] - set the debugging level
-y answer yes to all questions
-t be tolerant about errors in package commands
-R [time in minutes] - set the max amount of time to randomly run in.
-C run from cache only - do not update the cache
--installroot=[path] - set the install root (default '/')
--version - output the version of yum
-h, --help this screen

So in order to solve your problem, you would issue the command as:

yum -y install mysql mysql-devel mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

that should do it for you. Welcome to linx. Wait till you see some of the scripts out there. It makes batch scripting seem like child's play
Reply With Quote
  #4  
Old 15th June 2006, 18:40
PortMan PortMan is offline
Member
 
Join Date: Jun 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the respone. I was about to post what I had figured out using:
yum install mysql mysql-devel mysql-server < y
making a "y" file with "y" in it. I guess I would have done that wrong

The lost thing I want to do now is to figure out a way to edit a line in a file. For example, to change the httpd.conf file to:

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl

I have other files that I want to edit as well (change lines, add, delete).

Thanks.
Reply With Quote
  #5  
Old 16th June 2006, 02:29
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Quote:
Originally Posted by PortMan
The lost thing I want to do now is to figure out a way to edit a line in a file. For example, to change the httpd.conf file to:

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl

I have other files that I want to edit as well (change lines, add, delete).

Thanks.
Use a command line editor like vi: http://www.howtoforge.com/faq/12_15_en.html
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #6  
Old 16th June 2006, 07:43
serutan serutan is offline
Junior Member
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default World's smallest vi tutorial

Years ago as a VMS programmer I had to use vi to do some work on a Unix machine. Hated it. When I next encountered vi as a Linux newbie I forced myself to learn the minimum required to use it:

vi filename (start vi)
shift-i (start insert mode; do this immediately)
...now you can enter text, use Backspace or Delete, arrow keys to move around, Enter key to insert new lines, totally simple.
esc (stop insert mode, then enter one of the following...)
:wq (write and quit)
:q! (just quit, dammit!)

There's tons more you could learn about vi, and actually it's a very powerful editor, but the above is all you really need to know. Cheers!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BIND broke adamluz Installation/Configuration 4 2nd June 2006 21:31
site - databases trueshanti Installation/Configuration 20 26th May 2006 01:28
Mysterious Install Problem tgansert Installation/Configuration 5 9th May 2006 15:35
Update to 2.2.0 question brianetilley Installation/Configuration 10 4th March 2006 17:02
Debian install error jf1976 Installation/Configuration 25 19th January 2006 22:31


All times are GMT +2. The time now is 16:16.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.