Linux 开机启动websphere 服务

Linux 开机启动websphere 服务

1. 环境

    OS: SUSE

    Application Server:  Websphere 7

 

2. 准备shell 脚本

    启动websphere 服务脚本,命名为websphere

 

#!/bin/bash

#

#

#chkconfig: 2345 98 02
#description: start/stop the websphere

#

#/etc/init.d

#

startscript=/opt/IBM/WebSphere7/AppServer/bin/startServer.sh
shutscript=/opt/IBM/WebSphere7/AppServer/bin/stopServer.sh

#

PATH=/opt/IBM/WebSphere7/AppServer/java/bin:$PATH

#

#FUNCTIONS

start()
{

echo -n $"starting websphere"
$startscript server1 -profileName AppSrv01
echo "OK"

}


stop()
{

echo -n $"stopping websphere"
$shutscript server1 -profileName AppSrv01 -username admin -password password
echo "OK"
}


case "$1" in
start)

start
;;

stop)

stop
;;

restart)

$0 stop
$0 start

;;

*)

echo $"usage: $0 {start|stop|restart}"

exit 1

esac

exit 0



 

3. 拷贝上面脚本到 /etc/init.d 目录,不同linux系统有可能不一样,具体考考个系统的自动加载目录

 

4. 如果在编写文件的时候不是root用户,那需要赋予shell脚本的执行权力

    chmod 755 websphere

 

5. 加载系统启动项

    a.  chkconfig --add websphere

    添加成功后,可以利用chkconfig --list 来测试是否添加成功

    b. 添加启动级别

     chkconfig -level 2,3,4,5 websphere on  具体参考不同linux系统格式

 

 

6. 测试是否可以启动服务

    service websphere start

    service websphere stop

 

7. root用户下,直接reboot启动系统,看是否websphere应用已启动。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值