Ubuntu – Upstart is not seeing the new script


I've added a new script to /etc/init/ called minecraft.conf which contains the script:

start on startup
stop on shutdown
respawn limit 20 5

  export HOME="/root"
  exec /root/minecraft/start.sh 2>&1 >> /var/log/minecraft.log
end script

post-start script
   echo "minecraft started"

When I try start minecraft I get the error: start: Unknown job: minecraft

I've tried running initctl list and my minecraft job is not listed. I've tried running initctl reload-configuration and it doesn't make any difference.

Other jobs listed by initctl list work fine with start, stop and restart.

Why won't upstart see my new script?

Best Answer

An easy way to check your script syntax is with the following command:

init-checkconf -d /etc/init/service_name.conf

I've found that even with a valid Upstart file if the file didn't exist when the server was booted last I have to reboot the server for Upstart to see the file.