Shell 脚本不是可执行的常规文件
我使用Shell 脚本不是可执行的常规文件,shell,ubuntu,Shell,Ubuntu,我使用sudo nano yellowfin创建了一个脚本,然后输入下面的代码并保存了它,但是当我尝试运行它时,它给我一个错误,即script yellowfin不是一个可执行的常规文件,跳过了 文件中的代码 #!/bin/bash # USAGE: start|stop # case "$1" in start) echo "Starting Yellowfin." /opt/yf/appserver/bin/startup.sh ;; stop) echo "Stopping Yellowf
sudo nano yellowfin
创建了一个脚本,然后输入下面的代码并保存了它,但是当我尝试运行它时,它给我一个错误,即script yellowfin不是一个可执行的常规文件,跳过了
文件中的代码
#!/bin/bash
# USAGE: start|stop
#
case "$1" in
start)
echo "Starting Yellowfin."
/opt/yf/appserver/bin/startup.sh
;;
stop)
echo "Stopping Yellowfin."
/opt/yf/appserver/bin/shutdown.sh
;;
*)
echo “Yellowfin Service”
echo $”Usage: $0 {start|stop}”
exit 1
esac
exit 0
然后我用
sudo update-rc.d yellowfin defaults
首先,请确保您的脚本可通过chmod+x yellowfin
执行,并修复脚本缺少LSB标记和覆盖
在bash脚本顶部添加以下内容:
### BEGIN INIT INFO
# Provides: example
# 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. This example start a
# single forking daemon capable of writing a pid
# file. To get other behavoirs, implemend
# do_start(), do_stop() or other functions to
# override the defaults in /lib/init/init-d-script.
### END INIT INFO
你记得让脚本可执行吗?chmod+x yellowfin
现在我已经这样做了,并且得到了脚本缺少LSB标记和覆盖
,通过谷歌搜索该错误消息会让你…?可能是重复的