summaryrefslogtreecommitdiff
path: root/doc/s6-notifywhenup.html
blob: b95812508807ff29587468292ea3357d5c3a4df0 (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
78
79
80
81
82
83
84
85
86
87
88
89
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6-notifywhenup program</title>
    <meta name="Description" content="s6: the s6-notifywhenup program" />
    <meta name="Keywords" content="s6 command s6-notifywhenup fifodir notification event notifier send service daemon ready" />
    <!-- <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-notifywhenup program </h1>

<p>
s6-notifywhenup launches a daemon while listening to a file descriptor,
and sends a 'U' event to a <a href="fifodir.html">fifodir</a> when it
receives something on that file descriptor.
</p>

<p>
<a href="notifywhenup.html">This page</a> explains why this program is
needed.
</p>

<h2> Interface </h2>

<pre>
     s6-notifywhenup [ -d <em>fd</em> ] [ -e <em>fifodir</em> ] [ -f ] [ -X ] [ -t <em>timeout</em> ] <em>prog...</em>
</pre>

<ul>
 <li> s6-notifywhenup forks and executes <em>prog...</em> as the
parent, with a pipe from <em>prog...</em>'s stdout to the child. </li>
 <li> The child waits for a newline (<tt>\n</tt>) to be written
on the pipe. When it gets it, it creates a
<tt>./supervise/ready</tt> file then sends a 'U' event to the
<tt>./event</tt> fifodir. </li>
 <li> The child exits 0. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-d&nbsp;<em>fd</em></tt>&nbsp;: listen to
<em>prog</em>'s output on descriptor <em>fd</em>. The default is 1. </li>
 <li> <tt>-e&nbsp;<em>fifodir</em></tt>&nbsp;: send a 'U' event to fifodir
<em>fifodir</em>. Default is <tt>./event</tt>. </li>
 <li> <tt>-f</tt>&nbsp;: simple fork. Normally, s6-notifywhenup doubleforks,
in order to accommodate for a
<em>prog</em> that does not expect to have a child and avoid a
pending zombie. This option avoids the doublefork, but it should only be
set if <em>prog</em> reaps even children it doesn't know it has. </li>
 <li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if no EOF has been received
after <em>timeout</em> milliseconds, exit without sending the event.
Default is 0, meaning infinite. </li>
 <li> <tt>-X</tt>&nbsp;: fake readiness. s6-notifywhenup will actually send
the newline itself before executing <em>prog</em>. This option should in
principle never be used. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> s6-notifywhenup executes <em>prog...</em> as the parent in order
for <em>prog</em> to keep the same pid, which is vital for supervised
processes. </li>
 <li> s6-notifywhenup can be used, for instance, with
<a href="s6-ipcserver.html">s6-ipcserver</a>
and its <tt>-1</tt> option, so that reliable startup notification is
achieved. <tt>s6-notifywhenup -f s6-ipcserver -1 <em>args</em></tt> will
send a 'U' event to <tt>./event</tt> when s6-ipcserver is actually
listening to its socket. </li>
 <li> The <a href="s6-svwait.html">s6-svwait</a> program can be used
to wait for 'U' events, as well as the
<a href="s6-svlisten1.html">s6-svlisten1</a> and
<a href="s6-svlisten.html">s6-svlisten</a> programs. </li>
 <li> The <tt>supervise/ready</tt> file, when created, contains at least
the absolute time when s6-notifywhenup detected service readiness. The
format and contents of this file are subject to change. </li>
</ul>

</body>
</html>