Ubuntu – Creating a very simple upstart script

bashupstart

So I've been attempting to create an incredibly simple upstart script.

I started with:

console output

exec /srv/scripts/test.sh

But got this error:

start: Job failed to start

So I changed it to:

console output

script
   set -x
   echo "Hello world!"
end script

This seems to run just find and dandy, but I don't get any output anywhere, and I was told there would be something written to /var/log/upstart/test.log (my script is test.conf). There was nothing written to that log file- in fact, that log file doesn't actually exist.

What am I doing wrong? How do I get just a simple script to run?

Best Answer

Apparently Upstart is in error when it says you can use console and exec:

  • console does not work at all, and
  • exec only works if it's inside a script stanza.

Changing what I had to:

script
    exec /srv/scripts/test.sh
end script

worked, and it logged output in the log file. Unfortunately, I still have no idea how to log output to the console.

Related Question