mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-16 12:10:46 +01:00
Capture program output using a pipe shared with all child processes, and write to the file using a dedicated thread. Ensures lines emitted by the child processes will not be intermingled in the output file if the lines are less than PIPE_BUF chars long and are written in line- buffered mode. Reopen output file on HUP, to support external rotation of the file. New setting 'fileCreateMode' as in omfile. With these improvements the 'output' setting should now be usable for production (it was originally intended only for debugging). Redirect stdout/stderr of child process to /dev/null when not captured. Closes #2787 Minor: simplify some test code: 'wait-startup' not needed after 'startup', 'wait-queueempty' not needed before 'shutdown_when_empty'.
17 lines
305 B
Bash
Executable File
17 lines
305 B
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "[stdout] Starting"
|
|
>&2 echo "[stderr] Starting"
|
|
|
|
read log_line
|
|
while [[ -n "$log_line" ]]; do
|
|
echo "[stdout] Received $log_line"
|
|
>&2 echo "[stderr] Received $log_line"
|
|
read log_line
|
|
done
|
|
|
|
echo "[stdout] Terminating normally"
|
|
>&2 echo "[stderr] Terminating normally"
|
|
|
|
exit 0
|