I made a init script for a ghost website. I'm using Linux Mint 16 (aka Ubuntu 13.10)
When I type this, my script doesn't show up in autocomplete.
sudo service f<tab>
Any reason why? I get a different script "friendly_recover", but not mine.
Thanks!
Mike
/etc/init/furtheryet.org.conf
# furtheryet.org
start on startup
script
cd /var/www/furtheryet.org/ghost
npm start --production
end script
This is an old question, but I reached it through Google, and the selected answer is wrong.
Upstart jobs have to be placed to
/etc/init
folder.Every package that provides a standard daemon using upstart is required to provide a symlink in /etc/init.d by Debian policy.
Then, autocompletion for sudo service name will work.
There are special upstart jobs in /etc/init that do not have a corresponding entry in /etc/init.d. These are an exception.
If you're in the same directory type
./f
then hit<tab>
. Otherwise you have to type:/etc/init/f
before you hit<tab>
.And your script has to be executable:
Do you expect that
sudo service f<tab>
will auto-complete withsudo service furtheryet.org.conf
?No, it will not, because :
You should consider the
/etc/init.d
folder :The
/etc/init/
folder only contains configuration files used byUpstart
.The
/etc/init.d
folder contains shell scripts that respond tostart
,stop
,restart
,reload
(and whatwever you could implement).Further reading : https://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d
That said, to make your script auto-complete, you should at least put it in the
/etc/init.d
folder, and make it executable.But your script is actually just a config file. You should consider writing a specific service/init script and put it in your
/etc/init.d
folder.In some cases i've notice that even if the script is located in
/etc/init.d
you may have issues with auto-complete onUbuntu 13.10
asroot
user.To correct this, as root user, edit
$HOME/.bachrc
file and uncomment the following :Then reload your
.bashrc
file by running :. $HOME/.bashrc