Script Help - Multi Comands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Help - Multi Comands
# 1  
Old 11-06-2011
Script Help - Multi Comands

Hi guys I am trying to get a bunch of lines into a .sh script that will let me easily run a bunch of commands on its own without me having to be there... I have done this with other things but apparetnly it doesn't like to use yum.. I will post my script you will see what im trying to do..

Code:
#!/bin/bash
#Bare Bone Setup
RED='\033[01;31m'
RESET='\033[0m'
echo -e $RED"Yum Updates - Dev Tools - Ruby - mySQL ....... started"$RESET
yum update -y
yum groupinstall 'Development Tools' -y
yum install ruby -y
yum install httpd httpd-devel -y
/etc/init.d/httpd start
yum install mysql mysql-server mysql-devel -y
/etc/init.d/mysqld start
yum install php php-mysql php-common php-gd php-mbstring php-devel php-xml -y
yum install yasm subversion -y
chkconfig mysqld on
chkconfig httpd on
yum install nano -y
echo -e $RED"Installation of Yum Updates - Dev Tools - Ruby - mySQL ....... Completed"$RESET

when i take everything out but just 1 line like 'yum update -y' putty says

Putty Window it says
: command not found 8: yum install -y .... and a bunch of crap

any help to get this working would make my day a lot easier.. Thanks
# 2  
Old 11-06-2011
Can you paste the output of bash -x <your script>?

--ahamed
# 3  
Old 11-07-2011
actually i just found out why.. should have seen this it should be

yum -y update that -y needs to come first in a script i guess

HOWEVER im stuck at the nano part when i change nano to how it should be it errors out

Code:
Setting up Install Process
 available.nano
Error: Nothing to do

---------- Post updated 11-07-11 at 01:35 AM ---------- Previous update was 11-06-11 at 02:03 AM ----------

anything ?
# 4  
Old 11-07-2011
Hi,

We are using the below script for reading a variable from the xml file
Code:
VAR3=`grep -i "ServerName" /u/service.xml | grep -v "^#" |awk -F">" '{print $2}'|awk -F"</" '{print $1}'`
 
 
servername=`grep -i "Service.ServerName" /u/logic.properties | awk -F" " '{print $2}'`
echo "$VAR3"
echo "$servername"
 
 
if [ "$VAR3" != "" ] && [ "$servername" != "" ]
then
  sed  "s/$VAR3/$servername/g" /u/logs/tibco/LOG/jboss-service.xml > /u/service.txt
  mv /u/service.txt /u/service.xml
fi

XML file:
Code:
-->
   <mbean code="org..services.binding.ServiceBindingManager"
     name="system:service=ServiceBindingManager">
     <attribute name="ServerName">localhost1</attribute>
     <attribute name="StoreURL">${home.url}/server/bindings.xml</attribute>
     <attribute name="StoreFactoryClassName">
       org.services.binding.XMLServicesStoreFactory
     </attribute>
   </mbean>

whe do have a property file for the new values and with sed command we are replacing the existing variable value in xml with the property file values but we are getting
sed: command garbled: s/ exception even after using double quotes("") and if we put single quotes then the variable is not getting changed in xml file.
The value of Service.ServerName in the property file is localhost2.
appreciate for quick response.

Last edited by Franklin52; 11-07-2011 at 06:01 AM.. Reason: Please use code tags for data and code samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script multi listener

hello can help to script to find the listener is up or down for diferent db i have 2 listener ps -fea |grep tns root 17333 17559 0 12:26:38 pts/3 0:00 grep tns oracle 3800 1 1 Jul 23 ? 400:42 /u01/app/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit ... (1 Reply)
Discussion started by: ceciaide
1 Replies

2. Programming

Multi head/multi window hello world

I am trying to write a large X app. I have successfully modified my xorg.conf to setup 4 monitors on an NVIDIA Quatro5200. I am trying to modify a simple hello world application to open a window on three of the four monitors. depending on the changes to loop the window creation section and event... (2 Replies)
Discussion started by: advorak
2 Replies

3. Shell Programming and Scripting

Use of the below ftp comands

plz let me know what the below ftp is doing it . ftp -m amazon-d . -i /test/load/y748_W*.stc (1 Reply)
Discussion started by: ramkumar15
1 Replies

4. UNIX for Dummies Questions & Answers

Execute multiple comands on one single line

hi, I have a litle problem i wish to excute this comand : ./test.sh -e txt /home -l a so what it says is that "-e" shows me all the extenions that are ".txt" in "home" this works but then i wish that "-l" will show all files begining in this case with the letter "a" . Both comands work... (5 Replies)
Discussion started by: samirboss
5 Replies

5. Shell Programming and Scripting

How to substract selective values in multi row, multi column file (using awk or sed?)

Hi, I have a problem where I need to make this input: nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b look like this output: nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
Discussion started by: nricardo
4 Replies

6. Solaris

Solaris 10 network, process, database related comands

Hi everbody, Can anyone let me know the resources for list of network, process, database related commands of solaris10 possibly with little bit of explanation. Thanks in advance, Chandra Sekhar. (1 Reply)
Discussion started by: chandoo.java
1 Replies

7. Cybersecurity

comands inside the script

hi, i want to put a set of commands inside a script and executing commands sequentially. there are 2 commands, the first command copies the program from my machine to another machine, execute it and get the result on my machine. the second command removes the program which was copied to the... (4 Replies)
Discussion started by: mercuryshipzz
4 Replies

8. UNIX for Advanced & Expert Users

For Loops Within Ftp Comands

I am having trouble getting files to ftp over when I run the file names through a loop. If I just do one file it works, but inside of a for loop it does not. Help! ################section 2 cd /home/salazar/chk_data chmod 777 * ftp -n 161.241.--.-- <<! user anonymous \n ascii for... (6 Replies)
Discussion started by: jsalz638
6 Replies

9. Shell Programming and Scripting

how to identify the type of shell using comands..

Dear friends, please tell me how to identify the type of the shell (whether cShell, kshell or anything else) please tell me the command. waiting for ur reply.... regards, swamymns (2 Replies)
Discussion started by: swamymns
2 Replies

10. Programming

External comands in C?

Hey all, I'm writting my first C program (Apart from the little ones I did to learn the program). What I want for this program to do is ping a range of IP's and then place the reply if alive into a file the compare all in that file to the /etc/hosts file to find the host name. I know I... (2 Replies)
Discussion started by: merlin
2 Replies
Login or Register to Ask a Question