jojo's blog--快樂憂傷都與你同在
          為夢(mèng)想而來,為自由而生。 性情若水,風(fēng)起水興,風(fēng)息水止,故時(shí)而激蕩,時(shí)又清平……
          posts - 11,  comments - 30,  trackbacks - 0
          1. Add the script glassfish below to /etc/init.d
          Name of file = glassfish- e.g., glassfish-domain1
          -chmod a+x /etc/init.d/glassfish-

          2. To support service, the script must fulfill the below criteria:
          -3 functions: start, stop, restart
          -chkconfig level
          3. debug script # bash -x glassfish-
          4. to have glassfish start during boot (and stop during halt)

          run level: 2345
          start priority:64
          stop priority:36

          ln -s /etc/init.d/glassfish- /etc/rc0.d/K36glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc1.d/K36glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc2.d/S64glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc3.d/S64glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc4.d/S64glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc5.d/S64glassfish-
          ln -s /etc/init.d/glassfish- /etc/rc6.d/K36glassfish-

          5. reboot

          Linux command to chkconfig service start on boot
          #: ntsysv

          ps U
          service glassfish- status
          service glassfish- start

          ************glassfish****************************

          #!/bin/bash
          # chkconfig: 2345 64 36
          # description: GlassFish is a Java Application Server.
          # processname: glassfish
          # pidfile: /var/run/glassfish.pid

          # filename glassfish-

          # source function library
          . /etc/init.d/functions

          RETVAL=0
          GLASSFISH_BIN="/opt/glassfish/bin"
          PASSWORDPATH="/opt/glassfish/domains/dsss/config/startup-password"
          GFUSER="atworld"

          # Basename works with symbolic links.
          NAME="$(basename $0)"
          unset ISBOOT
          # Trim off the Sxx/Kxx prefix
          if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then
          NAME="${NAME:3}"
          ISBOOT="1"
          fi
          # Trim off the glassfish- prefix
          NAME=${NAME:10}

          # /etc/init.d/glassfish should never be called directly.
          if [ -z $NAME ]; then
          echo -n $"Cannot start Glassfish without specifying a domain."
          failure
          echo
          exit 1
          fi

          start() {
          echo -n $"Starting Glassfish V2 domain $NAME: "
          daemon --user $GFUSER --pidfile /var/run/glassfish-$NAME.pid "$GLASSFISH_BIN/asadmin start-domain --passwordfile $PASSWORDPATH $NAME"
          RETVAL=$?
          if [ $RETVAL -eq 0 ]; then
          PID=`ps U $GFUSER | grep $NAME | awk '{ print $1}'`
          echo $PID > /var/run/glassfish-$NAME.pid
          touch /var/lock/subsys/glassfish-$NAME
          fi
          echo
          }
          stop() {
          echo -n $"Shutting down Glassfish V2 domain $NAME: "
          $GLASSFISH_BIN/asadmin stop-domain $NAME
          RETVAL=$?
          [ $RETVAL -eq 0 ]
          rm -f /var/lock/subsys/glassfish-$NAME
          rm -f /var/run/glassfish-$NAME success || failure
          echo
          }

          case "$1" in
          start)
          start
          ;;
          stop)
          stop
          ;;
          restart|reload)
          stop
          start
          ;;
          condrestart)
          if [ -f /var/lock/subsys/glassfish-$NAME ]; then
          stop
          start
          fi
          ;;
          status)
          status glassfish-$NAME
          RETVAL=$?
          ;;
          *)
          echo $"Usage: $0 {start|stop|restart|condrestart|status}"
          exit 1
          esac

          exit $RETVAL

          ****************************************************

          References:
          http://www.thelinuxblog.com/adding-a-service-on-fedora/
          http://computingwithjasper.blogspot.com/2008/01/installing-glassfish-2-on-ubuntu-710.html
          http://www.cyberciti.biz/faq/rhel5-update-rcd-command/
          http://www.linux.com/feature/46892
          http://www.linuxjournal.com/article/4445
          http://www.comptechdoc.org/os/linux/startupman/linux_surcsysinit.html
          http://www.vias.org/linux-knowhow/fwpx_appendix_a_03.html
          http://www.cricalix.net/archives/2008/07/22/autostarting-glassfish-on-centos/
          http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch07_:_The_Linux_Boot_Process
          http://www.zimbra.com/forums/installation/10553-solved-sudo-sorry-you-must-have-tty-run-sudo.html
          http://www.linuxmanpages.com/man5/sudoers.5.php#lbAM
          http://www.yolinux.com/TUTORIALS/LinuxTutorialInitProcess.html
          posted on 2009-06-10 14:37 Blog of JoJo 閱讀(324) 評(píng)論(0)  編輯  收藏 所屬分類: 每日一記

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 临武县| 抚远县| 会东县| 龙岩市| 于都县| 神池县| 绥中县| 托克逊县| 营山县| 青岛市| 东方市| 皋兰县| 尚志市| 保靖县| 景泰县| 鄂托克旗| 四川省| 嘉禾县| 阳信县| 临颍县| 桐城市| 华容县| 星子县| 诏安县| 右玉县| 库尔勒市| 肃宁县| 绥江县| 黎平县| 正阳县| 门源| 宣汉县| 七台河市| 巩留县| 广昌县| 荥阳市| 罗平县| 蒲城县| 高碑店市| 屏南县| 墨竹工卡县|