Saturday, November 3, 2012

Linux: Create a service to automate Oracle BI Publisher 11g Trial Edition startup & shutdown

I used OEL 6.3 and Oracle BI Publisher 11g Trial Edition is installed under "oracle" user in:

Create in /home/oracle. This will start Publisher:

# Script to start BI Publisher

. ~/.bash_profile

# Start BI Publisher
nohup /oracle/BI_Publisher_Trial/bin/ &

exit 0

Create in /home/oracle. This will stop Publisher:

# Script to stop BI Publisher

. ~/.bash_profile

# Stop BI Publisher

exit 0

chmod u+x /home/oracle/bi*.sh

 Login as root and create /etc/init.d/publisher:
#! /bin/bash
# chkconfig: 2345 99 10
# description: BI Publisher auto start-stop script.

# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.


case "$1" in
# Start BI Publisher:
su - $ORA_OWNER -c "/home/oracle/"
touch /var/lock/subsys/publisher
# Stop BI Publisher:
su - $ORA_OWNER -c "/home/oracle/"
rm -f /var/lock/subsys/publisher
echo $"Usage: $0 {start|stop}"
exit $RETVAL

Execute as root:
chgrp dba /etc/init.d/publisher
chmod 750 /etc/init.d/publisher
chkconfig --add publisher

Check, if the service was created:
chkconfig|grep publisher
 publisher          0:off    1:off    2:on    3:on    4:on    5:on    6:off

Test it:
service publisher start
service publisher stop