LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 07-27-2005, 11:28 AM   #1
robthky
LQ Newbie
 
Registered: Sep 2003
Posts: 7

Rep: Reputation: 0
Scripting in init.d


I am runnign the following files to start two items in rc5.d/S99local:
rm -rf /opt/oracle/product/9.2.0/oracm/log/ocmstart.ts >>/tmp/startlog
export ORACLE_HOME=/opt/oracle/product/9.2.0/
/opt/oracle/product/9.2.0/oracm/bin/ocmstart.sh >>/tmp/startlog
su - oracle -c "/opt/oracle/product/9.2.0/bin/gsdctl start" >>/tmp/startlog

This seems to be working fine, but I am wanting this to work via chkconfig. I have written the following script in init.d/oracm_gsd, but I canot start or stop this as a service and it even though it pushed the appropriate K and S scripts into rc5.d and rc6.d the script(s) don't seem to be starting and stopping properly. It will not work on a reboot, nor can I use service oracm_gsd to start or stop these items. Here is the script:

#!/bin/bash

#
# chkconfig: 345 90 10
# description: This controls the oracm and the gsdctl start and stop

start() {
rm -rf /opt/oracle/product/9.2.0/oracm/log/ocmstart.ts >>/tmp/startlog
export ORACLE_HOME=/opt/oracle/product/9.2.0/
/opt/oracle/product/9.2.0/oracm/bin/ocmstart.sh >>/tmp/startlog
su - oracle -c "/opt/oracle/product/9.2.0/bin/gsdctl start" >>/tmp/startlog
touch /var/lock/subsys/oracm_gsd

}

stop() {
su - oracle -c "/opt/oracle/product/9.2.0/bin/gsdctl stop" >>/tmp/shutlog
killall oracm >>/tmp/shutlog
rm -f /var/lock/subsys/oracm_gsd

}

restart() {
stop
start
}

Any help would be appreciated.

Thanks,
Rob
 
Old 07-27-2005, 01:44 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,334

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
The script that you are having chkconfig place into init.d/oracm_gsd is incomplete. You have defined the start, stop, and restart functions but then you never actually issue a start, stop, or restart command. Therefore when init.d/oracm_gsd is executed your script does not do anything.

----------------------------
Steve Stites
 
Old 07-27-2005, 01:52 PM   #3
robthky
LQ Newbie
 
Registered: Sep 2003
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by jailbait
The script that you are having chkconfig place into init.d/oracm_gsd is incomplete. You have defined the start, stop, and restart functions but then you never actually issue a start, stop, or restart command. Therefore when init.d/oracm_gsd is executed your script does not do anything.

----------------------------
Steve Stites
What do you mean "Issue a start, stop, or restart"? I thought that anything listed under the start {} ( section would run when I do a service oracm_gsd start command. What am I missing? Can you give me an example please?
 
Old 07-27-2005, 03:08 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,334

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
"What do you mean "Issue a start, stop, or restart"? I thought that anything listed under the start {} ( section would run when I do a service oracm_gsd start command."

True, but you have not enterd any commands into init.d/oracm_gsd.

"What am I missing? "

You have no commands in your script.

"Can you give me an example please?"

Here is an example of executing a start command as you define it:

#
# chkconfig: 345 90 10
# description: This controls the oracm and the gsdctl start and stop

start() {
rm -rf /opt/oracle/product/9.2.0/oracm/log/ocmstart.ts >>/tmp/startlog
export ORACLE_HOME=/opt/oracle/product/9.2.0/
/opt/oracle/product/9.2.0/oracm/bin/ocmstart.sh >>/tmp/startlog
su - oracle -c "/opt/oracle/product/9.2.0/bin/gsdctl start" >>/tmp/startlog
touch /var/lock/subsys/oracm_gsd

}

stop() {
su - oracle -c "/opt/oracle/product/9.2.0/bin/gsdctl stop" >>/tmp/shutlog
killall oracm >>/tmp/shutlog
rm -f /var/lock/subsys/oracm_gsd

}

restart() {
stop
start
}

# The following line is the only command that this script executes.
start

----------------------------
Steve Stites

Last edited by jailbait; 07-27-2005 at 03:09 PM.
 
Old 07-27-2005, 05:29 PM   #5
robthky
LQ Newbie
 
Registered: Sep 2003
Posts: 7

Original Poster
Rep: Reputation: 0
Thumbs up Working

Thanks for your help. I added the following to the bottom of the script and it works great:

*)
echo "Usage: cworacm_gsd{start|stop|restart"
RETVAL=1
esac

exit $RETVAL
 
  


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
Kernel Panic No init found. Try passing init..... Adrian Baker Mandriva 2 02-28-2005 11:47 AM
Redhat linux9.0:System hangs,if gives init 3 or init 4 Sailaja Reddy Linux - Newbie 4 09-16-2004 03:19 AM
Kernal Panic: No init found. Try passing init= option to kernel raees Linux - General 12 03-18-2004 11:10 PM
error: No init found. Try passing the init= option to the Kernel neylitalo Linux - Laptop and Netbook 3 01-22-2004 09:34 PM
error "Kernel panic: No init found. Try passing init= option Anauj0101 Linux - Newbie 3 05-06-2003 10:18 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 06:56 AM.

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