1. go /etc/init.d/ create this file
vi weblogic
2. copy and paste the following into the file
#!/bin/bash
# weblogic start / stop script.
#
# chkconfig: 345 99 10
# description: Manage Weblogic services.
# Local Unix user running Weblogic
startup=/home/weblogic/domains/domain_02/bin/startWebLogic.sh
shutdown=/home/weblogic/domains/domain_02/bin/stopWebLogic.sh
WL_USER=weblogic
echo $WL_USER
start(){
echo -n $"Starting Weblogic service: "
su - $WL_USER -c $startup
RETVAL=$?
echo
}
stop(){
echo -n $"Stopping Weblogic service: "
su - $WL_USER -c $shutdown
RETVAL=$?
echo
}
status(){
numproc=`ps -ef | grep ServerTwo | grep -v "grep ServerTwo" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Weblogic is running..."
else
echo "Weblogic is stopped..."
fi
}
restart(){
stop
start
}
# How to call
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
3. save the file
4. run this comand: sudo /etc/init.d/weblogic start
Now you have weblogic running as a service in Redhat Linux! Enjoy it!
Note: for Ubuntu (Amazon WS), you may try this:
nohup
/home/weblogic/domains/domain_02/bin/startWebLogic.sh 0<&- &> wls.log &
No comments:
Post a Comment