Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 如何在引导时自动将start参数发送到Init脚本?_Shell_Unix_Debian - Fatal编程技术网

Shell 如何在引导时自动将start参数发送到Init脚本?

Shell 如何在引导时自动将start参数发送到Init脚本?,shell,unix,debian,Shell,Unix,Debian,我正在使用debian系统,希望为我的应用程序创建一个init启动脚本。在脚本中,我有一个不同(start | stop | restart)参数的case body。当脚本在启动时启动时,它会进入一个无限循环,因为它会遍历所有参数。这是我的剧本 #! /bin/sh ### BEGIN INIT INFO # Provides: skeleton # Required-Start: $remote_fs $syslog # Required-Stop: $rem

我正在使用debian系统,希望为我的应用程序创建一个init启动脚本。在脚本中,我有一个不同(start | stop | restart)参数的case body。当脚本在启动时启动时,它会进入一个无限循环,因为它会遍历所有参数。这是我的剧本

#! /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

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

如果路径在mountnfs.sh脚本之后运行,则仅应包括/usr/*路径


我自己发现的。在剧本中有一个无休止的对另一个剧本的呼唤。无论如何谢谢你