The control of IO (Input/Output) redirection can be managed using the keys StdIn, StdOut, and StdErr within the [Execute] section.
If none of the StdIn, StdOut, and StdErr keys are defined, the default behavior is to use the 66-log program. In this case, you can use the [Logger] section to modify the behavior of 66-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:
This key allows redirection of the Standard Input (file descriptor 0) of the service. As indicated in the documentation for the [Execute] section, this key accepts several values.
If the key is not defined, it will take the value of StdOut if StdOut is set to 66log or if StdOut is not defined at all.
StdIn = tty:/path/to/tty
In this case, the value of StdOut will be the same as StdIn regardless of the value set for StdOut.
StdIn = 66log
In this case, the value of StdOut will be 66log and the value of StdErr will be inherit regardless of the values set for StdOut and StdErr.
For the values null, parent, and close, the values of StdOut and StdErr will not be redefined.
This key allows redirection of the Standard Output (file descriptor 1) of the service. As indicated in the documentation for the [Execute] 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 66log.
This key takes precedence over StdErr depending on the chosen value.
If the value of StdOut is equal to StdErr, StdErr will be set to inherit(e.g. StdOut = tty:/dev/tty2 AND StdErr = tty:/dev/tty2).
StdOut = syslog
In this case, the value of StdErr will be the same as StdOut regardless of the value set for StdErr.
For the values tty, file, console, 66log, inherit, null, parent, and close, StdErr will not be redefined.
This key allows redirection of the Standard Error (file descriptor 2) of the service. As indicated in the documentation for the [Execute] 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.
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 66log or not defined at all, StdIn, StdOut, and StdErr will take the value parent.
Let’s take some examples:
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = 66log
StdOut = 66log
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = 66log
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = 66log
StdOut = 66log
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdOut = 66log
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = 66log
StdOut = 66log
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = tty:/dev/tty1
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = tty:/dev/tty1
StdOut = tty:/dev/tty1
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = tty:/dev/tty1
StdOut = syslog
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = tty:/dev/tty1
StdOut = tty:/dev/tty1
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = null
StdOut = syslog
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = null
StdOut = syslog
StdErr = syslog
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = null
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = null
StdOut = inherit
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = close
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = close
StdOut = parent
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdOut = syslog
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = parent
StdOut = syslog
StdErr = syslog
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdOut = tty:/dev/tty1
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = parent
StdOut = tty:/dev/tty1
StdErr = inherit
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdOut = tty:/dev/tty1
StdErr = file:/var/log/connman.log
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = parent
StdOut = tty:/dev/tty1
StdErr = file:/var/log/connman.log
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
Options = (!log)
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
Options = (!log)
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = parent
StdOut = parent
StdErr = parent
A frontend file with
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
Options = (!log)
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdOut = 66log
StdErr = file:/var/log/connmand.log
is strictly equal to
[Main]
Type = classic
Description = "connman daemon"
Version = 0.0.1
User = ( root )
Options = (!log)
[Start]
Execute = ( connmand -n --nobacktrace --nodnsproxy )
[Execute]
StdIn = parent
StdOut = parent
StdErr = file:/var/log/connmand.log