1

According to the documentation that I could find, daemontools' recommended way to capture stderr (or any other file descriptor) is to redirect it to stdout. If your service has a log/run script, your daemon's stdout will be piped to it.

This obviously means that stderr and stdout are mixed in the output of the logger. Has anyone any experience with capturing stdout and stderr separately in a daemontools-managed process?

mikewaters
  • 1,175
  • 1
  • 14
  • 27

1 Answers1

0

Looks like a shell question to me "How do I send stderr and stdout their separate way?" Assuming bash, or Bourne-ish syntax:

# 3 goes to wherever stdout is pointing
exec 3>&1
# send stdout of this cmd to FD 3, stderr somewhere else
eval $command 2>&1 1>&3 | sed 's/^/stderr from pipe: /'
# close FD 3
exec 3>&-
Alien Life Form
  • 2,309
  • 2
  • 21
  • 32