Starting WLS as a daemon process

Create the folloing script in /etc/init.d (as root)

/etc/init.d/oracle-wls
#!/bin/bash
#
#   /etc/rc.d/init.d/oracle-wls
#
# Starts the weblogic environment
#
# chkconfig: 2345 90 10
# description: Oracle-WLS Daemon

# processname: oracle-wls

source /etc/rc.d/init.d/functions

### Default variables
SYSCONFIG=”/etc/sysconfig/oracle-wls”

### Read configuration
[ -r “$SYSCONFIG” ] && source “$SYSCONFIG”

RETVAL=0
prog=”/home/oracle/bin/wls.sh”
desc=”Oracle WLS Daemon”
SU=/bin/su
SHELL=/bin/bash

START_AS_– USER=oracle

start() {
echo -n $”Starting $desc ($prog): “
$SU -s $SHELL $START_AS_– USER -c “$prog start” > /dev/null 2>&1
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
echo
}

stop() {
echo -n $”Shutting down $desc ($prog): “
$SU -s $SHELL $START_AS_– USER -c “$prog stop” > /dev/null 2>&1
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|condrestart}”
RETVAL=1
esac

exit $RETVAL

Make the script known the O/S for the various boot levels (as root):

chkconfig –add oracle-wls  && chkconfig oracle-wls on

You can test the script (as root)

# service oracle-wls stop
Shutting down Oracle WLS Daemon (/home/oracle/bin/wls.sh):  [  OK  ]

# service oracle-wls start
Starting Oracle WLS Daemon (/home/oracle/bin/wls.sh):   [  OK  ]

Please follow and like us:

Please add your comments here