Linux 开机启动websphere 服务

来源:互联网 发布:淘宝tommy代购是假货吗 编辑:程序博客网 时间:2024/05/22 19:42

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.shshutscript=/opt/IBM/WebSphere7/AppServer/bin/stopServer.sh#PATH=/opt/IBM/WebSphere7/AppServer/java/bin:$PATH##FUNCTIONSstart(){echo -n $"starting websphere"$startscript server1 -profileName AppSrv01echo "OK"}stop(){echo -n $"stopping websphere"$shutscript server1 -profileName AppSrv01 -username admin -password passwordecho "OK"}case "$1" instart)start;;stop)stop;;restart)$0 stop$0 start;;*)echo $"usage: $0 {start|stop|restart}"exit 1esacexit 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应用已启动。

 

 

原创粉丝点击