Autostart Weblogic using init.d

So you’ve got Weblogic installed and running in a large server farm and you want to ease operations support by starting Weblogic on server boot. The Windows version of Weblogic comes with a script to install Node Manager as a system service, however in order to autostart Weblogic on linux, you must write your own init.d script.

Node Manager per Domain

One way to autostart Weblogic is to start Node Manager as a service, then write scripts to use Node Manager to start your admin server and any managed servers.

Prior to 12c, Node Manager by default was installed with the Weblogic install not with a Weblogic domain. So by default, the previous version of Node Manager was used to manage all domains on a given application host.

Now with Oracle Weblogic 12c, the default behavior is to have a single Node Manager instance per domain. You can revert back to the old way and have a single Node Manager per host however.

When you create a Weblogic domain in 12c, you will find Node Mananger to be installed under <DOMAIN_HOME>/nodemanager and its start scripts under <DOMAIN_HOME>/bin.

Sample Script for Autostarting Weblogic

The sample Node Manager service script below has been written to work with Oracle Weblogic 12c and supports Node Manager for a single domain. This script will autostart Weblogic for a specific domain.

Save this file as [domain_name]-nm and place it under /etc/init.d

Intentionally leave off the file extension. Do not add .sh to the script.

Make sure root owns this file and that its readable by everyone.

Modify the Script

Before you can use this script, you must modify it to fit your environment. Locate the ### BEGIN CUSTOM ENV ### section of the script and modify the variables to match your environment.

The following variables will need to be updated:

Autostart Weblogic as the Weblogic Owner

By default init.d scripts are run and owned by root on your server. So you want this init.d Node Manager service to run Node Manager as the Weblogic domain owner, not root. If you run Node Manager as root, then root will end up owning files in your domain and that ends up creating problems and headaches.

The PROGRAM_START variable in the script specifies the command for starting Node Manager. We can simply use su to control who starts Node Manager:


su -c [command] [domain_owner]

For instance, if I have an OS user weblogic that owns the domain directory and all of its contents, I can use the following command to start Node Manager as weblogic.


su -c $DOMAIN_HOME/bin/startNodeManager.sh weblogic

So go ahead and modify the PROGRAM_START variable in the service script so that Node Manager is started by your domain owner.

Start Node Manager as a Service

Once you have modified the script to fit your environment, go ahead and add this new service as a system service using chkconfig. This will cause NM to be started each time on server boot.


chkconfig --add [domain_name]-nm

To manually start NM as a service, type:


service [domain_name]-nm start

The script you created will generate a stdout file under [DOMAIN_HOME]/nodemanager. Check this file for any error messages.

 

Autostart Weblogic using init.d
Tagged on:
Show Buttons
Hide Buttons