jojo's blog--快乐忧伤都与你同在
为梦想而来,为自由而生。 性情若水,风起水兴,风息水止,故时而激荡,时又清平……
posts - 11,  comments - 30,  trackbacks - 0

Here is how you run glassfish as a service on CentOS:

  1. Create a user glassfish (you can call it anything you want) under which Glassfish will run.
    #useradd glassfish
  2. Install glassfish in /home/glassfish.
  3. Create the startup script /etc/init.d/glassifsh for glassfish.
                    #!/bin/bash
    #
    # glassfish: Startup script for Glassfish Application Server.
    #
    # chkconfig: 3 80 05
    # description: Startup script for domain1 of Glassfish Application Server.

    GLASSFISH_HOME
    =/home/glassfish/glassfish;
    export GLASSFISH_HOME
    GLASSFISH_OWNER=glassfish;
    export GLASSFISH_OWNER

    start() {
    echo -n "Starting Glassfish: "
    echo "Starting Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
    su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log

    sleep 2
    echo "done"
    }

    stop() {
    echo -n "Stopping Glassfish: "
    echo "Stopping Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
    su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
    echo "done"
    }

    # See how we were called.
    case "$1" in
    start)

    start
    ;;

    stop)
    stop
    ;;

    restart)
    stop
    start
    ;;

    *)
    echo $"Usage: glassfish {start|stop|restart}"
    exit
    esac
  4. Install the service
    #chmod +x /etc/init.d/glassfish
    #chkconfig -add glassfish
    #chkconfig --level 3 glassfish on
  5. Start glassfish.
    #/etc/init.d/glassfish start
posted on 2009-06-10 14:39 Blog of JoJo 阅读(263) 评论(0)  编辑  收藏 所属分类: 每日一记My Script

只有注册用户登录后才能发表评论。


网站导航:
 

<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(6)

随笔档案

文章分类

文章档案

新闻分类

新闻档案

相册

收藏夹

搜索

  •  

最新评论

阅读排行榜

评论排行榜