Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have an upstart script like so:

start on runlevel [2345]

  exec su - ubuntu -c "cd /opt/app; bin/widget 2>&1 | logger -t 'widget'"
end script

The problem is when the widget process crashes, it doesn't respawn. Presumably because the logger process is still running. Any way around this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I would "outsource" the work to a bash script:

start on runlevel [2345]

  exec /path/to/bash/script
end script

the script

#! /bin/bash -e

su - ubuntu -c "cd /opt/app; bin/widget" |& logger -t 'widget'

exit ${PIPESTATUS[0]}

The PIPESTATUS array in bash stores pipe return values, in this case we use the return value of the su command.

share|improve this answer

Your Answer


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.