jojo's blog--快樂憂傷都與你同在
          為夢想而來,為自由而生。 性情若水,風起水興,風息水止,故時而激蕩,時又清平……
          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) 評論(0)  編輯  收藏 所屬分類: 每日一記

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

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 左云县| 驻马店市| 游戏| 邵阳市| 儋州市| 渝北区| 全南县| 锦屏县| 万全县| 赤壁市| 右玉县| 上饶县| 泸溪县| 永顺县| 涞水县| 五莲县| 武定县| 乌鲁木齐县| 连山| 崇义县| 浦城县| 九江县| 黑山县| 宝清县| 河西区| 丹寨县| 开封市| 辽宁省| 奎屯市| 金塔县| 台江县| 如东县| 古浪县| 荆门市| 赞皇县| 广丰县| 通海县| 天镇县| 淳安县| 济宁市| 崇信县|