Friday, March 14, 2008

Startup/shutdown Oracle EBS when linux is booted

For a demo, I installed Oracle EBS on a laptop with Oracle Linux version 4.
Because the consultants take thelaptop with them during the demo, and I am not present at that demo, I wanted the Oracle EBS to start when the laptop was turned on and also stopped when the laptop was turned off...

Starting Oracle EBS at laptop startup was not that kind of a problem. I just created a script in the /etc/rc.d/init.d directory called 'oracleebs'. Just a simple start script for EBS, just be sure to put this line in the script...

# chkconfig: 2345 99 10

This lets the chkconfig tool know in which runlevel the script must be started (2345) and the script should be started after all ohther scripts (99), the stop must be the 10th script to be run (10)

After creating the script, add your script using the chkconfig tool

chkconfig --add oraclebs

to check if the script was added.....

[root@ebsdemo init.d]# chkconfig --list

ipmi 0:off 1:off 2:off 3:off 4:off 5:off 6:off

sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off

readahead 0:off 1:off 2:off 3:off 4:off 5:on 6:off

apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

arptables_jf 0:off 1:off 2:on 3:on 4:on 5:on 6:off

oracleebs 0:off 1:off 2:on 3:on 4:on 5:on 6:off

I tested the startup and everything went fine. But when shutting down the laptop, the script was not executed. Offcourse the Oracle EBS was stopped, but I wanted it to be stopped the right way. I noticed the K* scripts in the runlevels 0,1 and 6. So why isn't the stop script executed ??

I found out, a simple touch was missing :)

The shutdown is checking if the proces that has to be stopped is actually running. If the proces is running, there must be an entry in the /var/lock/subsys...
So, when a touch /var/lock/subsys/oracleebs is added to the startup part of the script, the shutdown will also execute the stop part of the script. This time the Oracle EBS was stopped nicely.

Oh, booting linux is hanging on ' starting killall' .....
Don't forget to remove the created lock after the EBS is stopped. At the end of the script add
rm -f /var/lock/subsys/oracleebs
Now, booting linux runs smoothly

No comments: