4

I've created a script using sudo nano yellowfin and then put in below code and saved it, however when i try to run it it gives me the error that script yellowfin is not an executable regularfile, skipped

code in file

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

then i update with

 sudo update-rc.d yellowfin defaults
Peter Pik
  • 11,023
  • 19
  • 84
  • 142

1 Answers1

6

First make sure your script is executable with chmod +x yellowfin and to fix script missing LSB tag and overrides add this at the top of your bash script:

### 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
Maximilien Belinga
  • 3,076
  • 2
  • 25
  • 39