nikhilboorla Posted November 17, 2012 Report Posted November 17, 2012 How to configure node manager as linux daemon in redhat linux??
sudhilodhaaramsanduloberam Posted November 17, 2012 Report Posted November 17, 2012 [color=#112032][font=Tahoma, Verdana, sans-serif][size=3] [size=2]In order to have Node Manager start automatically it must be configured as a daemon. In order to do that, edit the below script to reflect your Weblogic installation path, then save it under /etc/init.d/nodemgr and run ‘chkconfig –add nodemgr’ as root.[/size][/size][/font][/color] [indent][i] #!/bin/sh # # nodemgr Oracle Weblogic NodeManager service # # chkconfig: 345 85 15 # description: Oracle Weblogic NodeManager service # The script needs to be saved as /etc/init.d/nodemgr and then issue chkconfig –add nodemgr as root[/i][i] ### BEGIN INIT INFO # Provides: nodemgr # Required-Start: $network $local_fs # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Short-Description: Oracle Weblogic NodeManager service. # Description: Starts and stops Oracle Weblogic NodeManager. ### END INIT INFO[/i][i] . /etc/rc.d/init.d/functions[/i][i] export MW_HOME=”/w01/oracle/bea” export JAVA_HOME=”/w01/jrrt-3.1.2-1.6.0″ DAEMON_USER=”oracle” PROCESS_STRING=”^.*/w01/oracle/bea/.*weblogic.NodeManager.*”[/i][i] source $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null export NodeManagerHome=”$WL_HOME/common/nodemanager” NodeManagerLockFile=”$NodeManagerHome/nodemanager.log.lck”[/i][i] PROGRAM=”$MW_HOME/wlserver_10.3/server/bin/startNodeManager.sh” SERVICE_NAME=`/bin/basename $0` LOCKFILE=”/var/lock/subsys/$SERVICE_NAME”[/i][i] RETVAL=0[/i][i] start() { OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING` if [ ! -z "$OLDPID" ]; then echo “$SERVICE_NAME is already running (pid $OLDPID) !” exit fi[/i][i] echo -n $”Starting $SERVICE_NAME: “ /bin/su $DAEMON_USER -c “$PROGRAM &”[/i][i] RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCKFILE }[/i][i] stop() { echo -n $”Stopping $SERVICE_NAME: “ OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING` if [ "$OLDPID" != "" ]; then /bin/kill -TERM $OLDPID else /bin/echo “$SERVICE_NAME is stopped” fi echo /bin/rm -f $NodeManagerLockFile [ $RETVAL -eq 0 ] && rm -f $LOCKFILE[/i][i] }[/i][i] restart() { stop sleep 10 start }[/i][i] case “$1″ in start) start ;; stop) stop ;; restart|force-reload|reload) restart ;; condrestart|try-restart) [ -f $LOCKFILE ] && restart ;; status) OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING` if [ "$OLDPID" != "" ]; then /bin/echo “$SERVICE_NAME is running (pid: $OLDPID)” else /bin/echo “$SERVICE_NAME is stopped” fi RETVAL=$? ;; *) echo $”Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}” exit 1 esac exit $RETVAL [/i][/indent][color=#112032][font=Tahoma, Verdana, sans-serif][size=3] Now the Node Manager can be controlled via the service command, for example to restart NM:[/size][/font][/color][color=#112032][font=Tahoma, Verdana, sans-serif][size=3] service nodemgr restart[/size][/font][/color][color=#112032][font=Tahoma, Verdana, sans-serif][size=3] With the NM restarting automatically after a system reboot, you might want the Weblogic managed server to act the same. To have the managed servers automatically restarted by Node Manager, you must activate the Autorestart option in the Administration Console as well as set the CrashRecoveryEnabled to ‘true’ in $WL_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties.[/size][/font][/color][color=#112032][font=Tahoma, Verdana, sans-serif][size=3] Notice that the weblogic servers will be restarted after a machine reboot only if they were actually running at the time the shutdown command was issues.[/size][/font][/color]
Recommended Posts