2017-03-17 105 views
0

我创建使用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 

然后我用

sudo update-rc.d yellowfin defaults 
+0

你有没有记得[改变模式位(http://man7.org/linux/man-pages/man1/chmod.1.html)使脚本可执行? –

+0

'chmod + x yellowfin' –

+1

现在我已经做到了,并得到'脚本缺少LSB标记和覆盖' –

回答

2

首先更新,确保您的脚本是可执行文件chmod +x yellowfin和修复script 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