summaryrefslogtreecommitdiff
path: root/doc/s6-notifywhenup.html
blob: 054e0f511b22ef7975abebda171d2ff3ad20a4bf (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
<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 ] [ -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 an empty
<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>
</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. </li>
</ul>

</body>
</html>