How To Fix The Ubuntu Upstart "Unknown job" Error

Today I experienced a mysterious error after updating an Ubuntu Upstart configuration file. Here is what happened, and how I fixed the error.

I had an existing upstart configuration file to keep a server running, which I modified to start after the database server has started.

Let's say the config file is called my-service.conf, and it's placed in /etc/init/. When I tried to start my service using the command:

sudo start my-service

I got this weird error message:

start: Unknown job: my-service

I had no clue what this meant. The file was right where it should be, it worked fine before the modification, file permission are right (owned, and readable by root).

Finally, it dawned on me that there must be a syntax error in the configuration file.

And sure enough, my modification had introduced a syntax error in the configuration file. After correcting the error, I was able to start the service without any error message.