Sponsored Content
Top Forums Shell Programming and Scripting Help with shell script 'CASE $' Post 302909495 by welldone on Thursday 17th of July 2014 10:58:42 AM
Old 07-17-2014
Help with shell script 'CASE $'

Hi,
I have a script that is called by /etc/init.d/S99oracle and the contents of this script are below.

Code:
$ cat ../init.d/oracle
### BEGIN INIT INFO
# Provides: oracle
# Required-Start: $ALL
# Required-Stop:
# Default-Start:  3 5
# chkconfig: 35 99 10
# Default-Stop:
# Description: Start/stop the Oracle database engine
### END INIT INFO
echo $1
case $1 in
      start)
                echo "Starting Oracle"
                 /u/bin/oracle_start
                ;;
      stop)
                echo "Stopping Oracle"
                 /u/bin/oracle_stop
                ;;
esac

Now, when I run one of the above 2 scripts (/u/bin/oracle_start
or /u/bin/oracle_stop) manually, they work fine, however when they are called on server reboot, the /u/bin/oracle_start fails. The content of /u/bin/oracle_start are below. Any advice?

Code:
 $ cat /u/bin/oracle_start
#run as root
### BEGIN INIT INFO
# Provides: oracle
# Required-Start: $ALL
# Required-Stop:
# Default-Start:  3 5
# chkconfig: 35 99 10
# Default-Stop:
# Description: Start the Oracle database engine
### END INIT INFO
set -x
DT=`date +"%m%d%H%M"`
ORACLE_LOG=/tmp/oracle_start.$DT
echo "Starting cssd." >> $ORACLE_LOG
# /u/oracle/server/oracle10g/bin/localconfig reset 2>&1 >> $ORACLE_LOG
if [ $? -ne 0 ]
then
  echo "Failure starting cssd!" >> $ORACLE_LOG
  exit 1
fi
echo "Starting ASM and database." >> $ORACLE_LOG
/bin/su oracle -c '. /u/oracle/home/.oraenv > /dev/null; $ORACLE_HOME/bin/./dbstart $ORACLE_HOME' 2>&1 >> $ORACLE_LOG
if [ $? -ne 0 ]
then
  echo "Failure starting ASM and database!!" >> $ORACLE_LOG
  echo "Continuing with Agent startup" >> $ORACLE_LOG
fi
echo "Starting Grid Control Agent." >> $ORACLE_LOG
/bin/su oracle -c '. /u/oracle/home/.oraenv > /dev/null;  $AGENT_HOME/bin/./emctl start agent' 2>&1 >> $ORACLE_LOG
if [ $? -ne 0 ]
then
  echo "Failure starting agent!" >> $ORACLE_LOG
fi


-Thanks-

Last edited by Corona688; 07-17-2014 at 12:06 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

2. Shell Programming and Scripting

Shell script automation using case statement

Hi, I'm trying to write a shell script that has a menu and then dependant on the selection, will automate some samba file transfer. The problem is when I run the code without the case statement it runs fine. but when I put the case statement in the only way I can get the code to run is to... (6 Replies)
Discussion started by: ianf
6 Replies

3. UNIX for Advanced & Expert Users

Shell script to convert to Title case

I need a shell script which will convert the given string to Title case. E.g "hi man" to "Hi man" (5 Replies)
Discussion started by: SankarV
5 Replies

4. Shell Programming and Scripting

shell script case statement

In a case statement like below : case $rental in "car") echo "For $rental Rs.20 per k/m";; "van") echo "For $rental Rs.10 per k/m";; "jeep") echo "For $rental Rs.5 per k/m";; "bicycle") echo "For $rental 20 paisa per k/m";; *) echo "Sorry, I can not gat a $rental for you";;... (4 Replies)
Discussion started by: sriram003
4 Replies

5. Shell Programming and Scripting

Shell script dynamically case in VAR

Hallo, I am working on a kdialog. This shall be able to load the required commands from a .conf file. First step runs good by loading the entries (selectabel entries) in a variable: MIRRORSELECT=$(kdialog --radiolist "Select your nearest mirror" $VAR1) The kdialog is accordingly correct... (2 Replies)
Discussion started by: ACTGADE
2 Replies

6. Shell Programming and Scripting

Combination of case and If else in shell script

Would it be right forme to combine case statement and if else in one shell script? Would it work? (2 Replies)
Discussion started by: Pauline mugisha
2 Replies

7. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

8. UNIX for Advanced & Expert Users

Shell script to convert words to Title case

Hi :) I have a .txt file with thousands of words. I was wondering if i could use a simple sed or awk command to convert / replace all words in the text file to Title Case format ? Example: from: this is line one this is line two this is line three to desired output: This Is Line... (8 Replies)
Discussion started by: martinsmith
8 Replies

9. Shell Programming and Scripting

Case statement in UNIX shell script

have written the below code to check whether the string received from user is a file name or dir using case statement, but its going into default case*). #!/bin/sh #Get a string from user and check whether its a existing filename or not rm str2 rm str3 echo "enter a file \c" read fil... (8 Replies)
Discussion started by: Mohan0509
8 Replies

10. UNIX for Beginners Questions & Answers

Restarting shell script in case of a failure

I have a shell script which sqoops data from one place to hive and it does in 2 groups list. If one group is completed it waits for the second to get completed then goto to orc load, but it it fails it kills the other groups and sends a fail email. What I was looking for is if 1 group fails, it... (1 Reply)
Discussion started by: Kunalcurious
1 Replies
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy