Websphere启停脚本

编程

#!/bin/bash/
#####################################
##注意 :使用root用户启动
##建议was安装使用专门用户 wasadmin,避免使用root用户操作
# chkconfig: 2345 26 80
# description: start and stop webspere server1 with service command
##
##===================================
##1、创建文件夹  /script/timer
##2、复制文件到文件夹内
##3、授权 chmod +x /script/timer/initwas.sh
##4、root用户设置定时任务,如下设置:crontab -e,添加命令内容
##00 23 * * 7 /script/timer/initwas.sh restart >>/logs/initwas.log
##分 时 几号 月 星期[1-7] 
#####################################
echo "-----------------was operation `date`-----------------------"
waspath="/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin"    
 case $1 in
    start)
        echo "========starting Websphere==========="
        sleep 2
        $waspath/startServer.sh server1
        ;;
    stop)
        echo "========stoping Websphere=========="
        $waspath/stopServer.sh server1 -username wasadmin -password wasadmin 
        sleep 2
    ;;
    restart)
    echo "========[ restart was ]========= "
    $waspath/stopServer.sh server1 -username wasadmin -password wasadmin
    if [ $? -eq 0 ] ; then
        sleep 2
        echo "=========stop was success !!! && start was ......"
        $waspath/startServer.sh server1
        if [ $? -eq 0 ] ; then
            echo "==========start was success!!!"
        else
            echo "**************start was fail ,please connect to Administrator!!!"
        fi
    else
        echo "**************stop was fail ,please connect to Administrator!!!"
    fi
    ;;

    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac
 

以上是 Websphere启停脚本 的全部内容, 来源链接: utcz.com/z/517645.html

回到顶部