1

I created Weblogic server as a service to start at boot up of machine by creating weblogic file inside directory /etc/init.d/ with below content:

#!/bin/sh

. /etc/default/weblogic

start() {
    nohup ${WLSHOME}/server/bin/startNodeManager.sh && ${WLSHOME}/common/bin/wlst.sh /opt/nmstart-${ADMINSERVER}.py
    for i in $SERVERS; do
    ${WLSHOME}/common/bin/wlst.sh /opt/start-"$i".py &
    done
}

stop() {
      ${DOMAINPATH}/bin/stopWebLogic.sh -username ${USER} -password ${PASSWORD}
}

case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    stop
    start
    ;;
*)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

and another file with same name(weblogic) inside directory /etc/default/ with content as follows:

# /etc/default/weblogic script used to configure the init script
WLSHOME="/opt/weblogic/wlserver_10.3"
DOMAINPATH="/opt/weblogic/projects/test"

# Username password for stopping
USER="weblogic"
PASSWORD="weblogic1"

# Servers to start
SERVERS="wlserver-1 wlserver-2 "
ADMINSERVER="AdminServer"

When I run the command sudo service weblogic start, server starts but on restarting the machine weblogic service not started.

Then, I followed this and this questions to make it work, but none of them works for me.

P.S: running the command sudo update-rc.d weblogic defaults, gives me output:

update-rc.d: warning: /etc/init.d/weblogic missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/weblogic already exist.

Any idea how can I make weblogic service to start at machine boot up?

Thanks, any help will be appreciated.

1 Answers1

1

Finally I found the answer to the problem and thought of sharing it for future readers, the problem is nohup command used in the start block:

start() {
    nohup ${WLSHOME}/server/bin/startNodeManager.sh && ${WLSHOME}/common/bin/wlst.sh /opt/nmstart-${ADMINSERVER}.py
    for i in $SERVERS; do
    ${WLSHOME}/common/bin/wlst.sh /opt/start-"$i".py &
    done
}

At time of machine reboot, nohup is ignored making NodeManager script not to run as a background process which I can see in /var/log/boot.log file:

nohup: ignoring input and appending output to 'nohup.out'

So, tweaking the start block to use ampersand (&) for running the NodeManager script in background instead of nohup worked, as follows:

start() {
        ${WLSHOME}/server/bin/startNodeManager.sh &
        ${WLSHOME}/common/bin/wlst.sh /opt/nmstart-${ADMINSERVER}.py
        for i in $SERVERS; do
        ${WLSHOME}/common/bin/wlst.sh /opt/start-"$i".py
        done
}