0

我正在使用 debian 系统并希望为 myapplication 提供一个 init 启动脚本。在脚本中,我有一个用于不同 (start|stop|restart) 参数的案例主体。当脚本在启动时启动时,它会进入无限循环,因为它会遍历所有参数。这是我的脚本

#! /bin/sh
### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO


 PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="Studio-service"
 NAME=application-studio
 automatey_nodetype=development
 vmargs="-DencryptorCredentials=currentPass|oldPass|1 -Xms512m -Xmx2048m
 - DLOGGING_HOME=configuration/ -Djava.io.tmpdir=/var/tmp 
 - Dorg.osgi.service.http.port=8081 -Declipse.ignoreApp=true 
 -Dosgi.noShutdown=true -Xdebug -Xnoagent -Djava.compiler=NONE 
  -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n 
  -Djava.net.preferIPv4Stack=true -DapplyDbMigrations=true -XX:MaxPermSize=128m 
  -XX:- HeapDumpOnOutOfMemoryError "
 SCRIPTNAME=/etc/init.d/$NAME
 DAEMON=start.sh
 STUDIO=/opt/application


case "$1" in
start)  
    set -e -x
    cd /opt/application
    ./firewall.sh
    ${STUDIO}/${DAEMON} ${automatey_nodetype} "$echo $vmargs"

;;
stop)
    screen -SX application-studio kill
;;


restart)
    set -e -x
    ${STUDIO}/${DAEMON} ${automatey_nodetype} "$echo $vmargs"
;;
esac

出口 0

4

1 回答 1

1

在启动时,初始化脚本使用start参数运行。无需指定任何内容。也许你需要评论这一行:

PATH 应该只包含 /usr/* 如果它在 mountnfs.sh 脚本之后运行

于 2012-10-24T17:11:06.537 回答