我已经使用 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
关于shell - 脚本不是 en 可执行常规文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42854122/