The s6-setsid program
s6-setsid runs a program as a new session leader, or in a new foreground or background process group.
Interface
s6-setsid [ -s | -b | -f | -g ] [ -i | -I | -q ] [ -d ctty ] prog...
- s6-setsid creates a new session, or a new process group, and may make that process group the foreground process group, depending on the options it is run with.
- As session leader or process group leader, s6-setsid then executes into prog....
Options
- -s : session. s6-setsid will try and execute prog as a session leader. This is the default.
- -b : background process group. s6-setsid will not create a new session, but will create a new process group, and try and execute prog as the new process group leader.
- -f : foreground process group. s6-setsid will not create a new session, but will create a new process group and attach its session's controlling terminal to the new process group before executing prog. However, the new process group will likely be stopped, waiting for the former foreground process group to relinquish the controlling terminal, and will need to be sent a SIGCONT to resume. To avoid that, use the next option.
- -g : grab terminal. s6-setsid will not create a new session, but will create a new process group and attach its session's controlling terminal to the new process group before executing prog. It will forcefully grab the controlling terminal from the former foreground process group: a process belonging to that former foreground process group will be stopped if it attempts to read from or write to that terminal.
- -i : strict. If s6-setsid cannot perform the operations it needs, it will exit 111 with an error message.
- -I : loose. If s6-setsid cannot perform the operations, it will print a warning message, but exec into prog nonetheless. This is the default.
- -q : silent. s6-setsid will not print any warning message; it will exec into prog even if it cannot perform the operations.
- -d ctty : assume file descriptor number ctty is the controlling terminal for the current session. (By default, the value is obtained from /dev/tty.) This is only useful when used with the -f or -g options.
