summaryrefslogtreecommitdiff
path: root/doc/s6-setsid.html
blob: 966c723d07e51718ea752ccc6e9b39ed1942e54f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6-setsid program</title>
    <meta name="Description" content="s6: the s6-setsid program" />
    <meta name="Keywords" content="s6 command s6-setsid session leader setting" />
    <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6</a><br />
<a href="http://skarnet.org/software/">Software</a><br />
<a href="http://skarnet.org/">skarnet.org</a>
</p>

<h1> The s6-setsid program </h1>

<p>
 s6-setsid runs a program as a new session leader, or in a new
foreground or background process group.
</p>

<h2> Interface </h2>

<pre>
     s6-setsid [ -s | -b | -f | -g ] [ -i | -I | -q ] [ -d ctty ] <em>prog...</em>
</pre>

<ul>
 <li> 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. </li>
 <li> As session leader or process group leader, s6-setsid then
executes into <em>prog...</em>. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-s</tt>&nbsp;: session. s6-setsid will try and execute
<em>prog</em> as a session leader. This is the default. </li>
 <li> <tt>-b</tt>&nbsp;: background process group. s6-setsid will
not create a new session, but will create a new process group, and
try and execute <em>prog</em> as the new process group leader. </li>
 <li> <tt>-f</tt>&nbsp;: 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 <em>prog</em>. 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. </li>
 <li> <tt>-g</tt>&nbsp;: 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 <em>prog</em>. 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. </li>
 <li> <tt>-i</tt>&nbsp;: strict. If s6-setsid cannot perform the
operations it needs, it will exit 111 with an error message. </li>
 <li> <tt>-I</tt>&nbsp;: loose. If s6-setsid cannot perform the operations,
it will print a warning message, but exec into <em>prog</em> nonetheless.
This is the default. </li>
 <li> <tt>-q</tt>&nbsp;: silent. s6-setsid will not print any warning
message; it will exec into <em>prog</em> even if it cannot perform the
operations. </li>
 <li> <tt>-d&nbsp;<em>ctty</em></tt>&nbsp;: assume file descriptor
number <em>ctty</em> is
the controlling terminal for the current session. Default is 0.
This is only useful when used with the <tt>-f</tt> or
<tt>-g</tt> options. </li>
</ul>

</body>
</html>