Table of Contents

Currently viewing version: 0.8.0.1

Standard IO Redirection

The control of IO (Input/Output) redirection can be managed using the keys StdIn, StdOut, and StdErr within the Main section.

If none of the StdIn, StdOut, and StdErr keys are defined, the default behavior is to use the s6-log program. In this case, you can use the Logger section to modify the behavior of s6-log (see the Logger section documentation) such as log file rotation.

It should be noted that administrative permissions may be required for values tty, console, and syslog. A service run as a regular user will not have the necessary rights to access, for example, tty3.

Depending on the definition and combination of these keys, the behavior will be as follows:

StdIn

This key allows redirection of the Standard Input (file descriptor 0) of the service. As indicated in the documentation for the Main section, this key accepts several values.

If the key is not defined, it will take the value of StdOut if StdOut is set to s6log or if StdOut is not defined at all.

Redefinition of StdOut and StdErr based on the value of StdIn

StdOut

This key allows redirection of the Standard Output (file descriptor 1) of the service. As indicated in the documentation for the Main section, it accepts several values.

If the key is not defined, it will take the value of StdIn as follows:

In all other cases, StdOut will take the value s6log.

This key takes precedence over StdErr depending on the chosen value.

Redefinition of StdErr based on the value of StdOut

StdErr

This key allows redirection of the Standard Error (file descriptor 2) of the service. As indicated in the documentation for the Main section, it accepts several values.

If the key is not defined, it will be set to inherit.

In all other cases, no redefinition is made.

Options defined on !log

If the Options key in the Main section defines !log, the Logger section will have no effect. Additionally, if the keys StdIn, StdOut, or StdErr are set to s6log or not defined at all, StdIn, StdOut, and StdErr will take the value of parent process.

Examples

Let's take some examples: