Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

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
share|improve this answer
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.