Last active
July 20, 2022 13:10
-
-
Save AKSarav/888a6c539605a2c2febcf606615a044d to your computer and use it in GitHub Desktop.
NodeManager Startup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# NodeManager Start/Stop NM | |
# | |
# | |
# chkconfig: 35 99 01 | |
# description: Script for Starting/Stopping Admin Server | |
# source function library | |
. /etc/rc.d/init.d/functions | |
RETVAL=0 | |
prog="NodeManager" | |
OS_USER=weblogic | |
DOMAIN_HOME="/opt/weblogic/domains/test" | |
PID_FILE=/var/run/$prog.pid | |
LOCK_FILE=/var/lock/subsys/$prog | |
start() { | |
echo $"Starting $prog..." | |
if [[ -e $LOCK_FILE ]]; then | |
echo "Node manager already running" | |
exit 1 | |
fi | |
su $OS_USER -c "$DOMAIN_HOME/bin/startNodeManager.sh " > /dev/null 2>&1 & | |
PID=$! | |
RETVAL=$? | |
[ "$RETVAL" = 0 ] && touch $LOCK_FILE && echo $PID > $PID_FILE | |
echo "$prog started" | |
} | |
stop() { | |
echo "Stopping Node Manger" | |
kill -9 `ps -ef | grep 'start[N]ode\|[w]eblogic.NodeManager' | awk '{print $2}'` | |
RETVAL=$? | |
[ "$RETVAL" = 0 ] && rm $LOCK_FILE && rm $PID_FILE | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
condrestart) | |
if [ -f /var/lock/subsys/$prog ] ; then | |
stop | |
# avoid race | |
sleep 3 | |
start | |
fi | |
;; | |
status) | |
status $prog | |
RETVAL=$? | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" | |
RETVAL=1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment