10

To monitor what my job definitions are doing, I would like to see text output from the jobs. That does not seem to be possible when I am logged on via SSH.

I am having this problem with Natty 11.04, but I am convinced that it is a more common one.

A simple job file I use (filename /etc/init/test.conf):

description "test"
start on test
console owner
kill timeout 5
task
script
  /bin/echo Gotcha...
end script

My goal is to see the text "Gotcha..." when doing initctl emit test or initctl start test. But that does not work.

What I have tried so far:

  • "console output" instead of "console owner"
  • "exec /bin/echo Gotcha..." instead of script...end script

2 Answers 2

16

As of 12.04 (Possibly before), by default, upstart will log to a file under /var/log/upstart/ with any output from the job

Current documentation of Upstart (on Cookbook)

You can then tail that file to see all new text that is being written to the file

For example:

tail -f /var/log/upstart/test.log & # tail the output
initctl emit test
8

Since init (pid 1) is running the service (which has no stdout/stderr) and not your shell (like with older /etc/init.d-style scripts), there is presently no way to see the output that is generated. (This feature is frequently requested and is on the list of things to do for Upstart.)

To work around this, I recommend forcing output redirection at the start of the job itself:

script
    exec >/var/log/test.debug 2>&1
    echo Gotcha...
end script

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .