根据公司具体业务编写基础weblogic启动脚本


\#!/bin/bash #***************************************************** # Author: suixiaofeng # blog:https://bk.devopstack.cn # Email: 258818040@qq.com # Last modified: 2017-07-12 19:45 # Filename: weblogic # Description: #**************************************************** # chkconfig: - 20 80 # description: Starts and stops the redis daemon. [ -f /etc/init.d/functions ] && . /etc/init.d/functions weblogic_path=/u02/weblogic [ UID -ne 0 ] && { echo "please use root." exit 1 } [ -d "weblogic_path" ] || { echo "weblogic is not install." exit 2 } function start () { # stapro=`ps -ef|grep weblogic|grep -v grep|wc -l` stapro=`ps aux|egrep "/u02/weblogic|weblogic.Server" |grep -vE 'egrep|*.sh'|wc -l` if [ stapro -ge 1 ] ; then echo -e "\033[32mweblogic is running \033[0m" exit 3 else su - oracle -c /home/oracle/ws.sh if [? -eq 0 ] then action "weblogic is started" /bin/true else action "weblogic is started" /bin/false fi fi } function stop () { stopro=`ps aux|egrep "/u02/weblogic|weblogic.Server" |grep -vE 'egrep|*.sh'|wc -l` if [ stopro -eq 0 ] ; then echo -e "\033[32mweblogic is stoping!\033[0m" exit 4 else PIDnum=`ps aux|egrep "/u02/weblogic|weblogic.Server" |grep -vE 'egrep|*.sh'|awk '{print2}'` su -c " kill -9 PIDnum " oracle >/dev/null 2>&1 if [? -eq 0 ] ;then action "weblogic is stoping" /bin/true else action "weblogic is stoping" /bin/false fi fi } function status () { stapr=`ps aux|egrep "/u02/weblogic|weblogic.Server" |grep -vE 'egrep|*.sh'|wc -l` if [ stapr -ge 1 ] ; then echo -e "\033[32mweblogic is running. \033[0m " else echo -e "\033[32mweblogic is stopping. \033[0m " fi exit 0 } case1 in "start") start ;; "stop") stop ;; "restart") stop sleep 2 start ;; "status") status ;; *) echo "Usage:0 {start|stop|restart|status}" exit 4 esac exit 0
  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: