脚本不是可执行的常规文件

Pet*_*Pik 4 shell ubuntu

我已经使用创建了一个脚本sudo nano yellowfin,然后放入下面的代码并保存它,但是当我尝试运行它时,它给了我错误script yellowfin is not an executable regularfile, skipped

文件中的代码

#!/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
Run Code Online (Sandbox Code Playgroud)

然后我更新

 sudo update-rc.d yellowfin defaults
Run Code Online (Sandbox Code Playgroud)

Max*_*nga 6

首先确保你的脚本是可执行的,chmod +x yellowfinscript missing LSB tag and overrides在你的 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
Run Code Online (Sandbox Code Playgroud)