O.S Start/Stop script integration until Red Hat/Oracle Linux 6

DMK provides a tiny script which integrated to the boot procedure serves to start & stop all the oracle services smoothly, source code:

cat ${DMK_HOME}/templates/init.d/oracle.linux
#!/bin/bash
...
case "$1" in
'start')
su - oracle -c "$
{DMK_HOME:-/u01/app/oracle/local/dmk}/bin/service_start_stop.ksh start"
touch /var/lock/subsys/oracle
;;
'stop')
su - oracle -c "$
{DMK_HOME:-/u01/app/oracle/local/dmk}/bin/service_start_stop.ksh stop"
rm -f /var/lock/subsys/oracle
;;
*)
echo "usage $0 {start|stop}"
exit 1
;;
esac

Below, all steps for the implementation & integration into the boot sequence:

  • Firstly, copy the script to the ā€œ/etc/init.dā€ and set the correct privileges as the user root.

cp $DMK_HOME/templates/init.d/oracle.linux /etc/init.d/oracle
chmod 755 /etc/init.d/oracle
  • Secondly, integrate the new script to the boot sequence (again as root)

[root@svr01 ~]# /sbin/chkconfig --add oracle

All necessary metadata for the Run-Levels are available within the script.

  • Verify the integration

[root@svr01 ~]# /sbin/chkconfig --list oracle
oracle 0:off 1:off 2:off **3:on** 4:off **5:on** 6:off
  • Finally run the script

[root@svr01 ~]# /etc/init.d/oracle start

Last updated