summary refs log tree commit diff
path: root/doc/s6-svunlink.html
blob: 5a4bf1b7feca84aaac6f23111e146a50ee599353 (plain) (blame)
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
90
91
92
93
94
95
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6-svunlink program</title>
    <meta name="Description" content="s6: the s6-svunlink program" />
    <meta name="Keywords" content="s6 command s6-svunlink supervision service stop unlink scandir servicedir" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

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

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

<p>
 <tt>s6-svunlink</tt> unlinks a <a href="servicedir.html">service
directory</a> from a <a href="scandir.html">scan directory</a>, then
notifies <a href="s6-svscan.html">s6-svscan</a> that a service has
been unregistered. It waits until the <a href="s6-supervise.html">s6-supervise</a>
supervisor process managing the service has disappeared, then exits.
</p>

<p>
 The point of <tt>s6-svunlink</tt> is to help integrate
service directories into an existing service manager sequence and
eliminate race conditions.
</p>

<h2> Interface </h2>

<pre>
     s6-svunlink [ -X ] [ -t <em>timeout</em> ] <em>scandir</em> <em>name</em>
</pre>

<ul>
 <li> <tt>s6-svunlink</tt> expects a running <a href="s6-svscan.html">s6-svscan</a>
process on <em>scandir</em> and a fully functional supervised service on
<a href="servicedir.html">service directory</a> in <em>scandir</em><tt>/</tt><em>name</em>,
which must be a symbolic link to a real directory located somewhere else. </li>
 <li> It deletes the <em>scandir</em><tt>/</tt><em>name</em> symlink. </li>
 <li> It sends a command to <a href="s6-svscan.html">s6-svscan</a> to signal it
that a service has disappeared. </li>
 <li> It waits for the <a href="s6-supervise.html">s6-supervise</a> process
managing the service directory to exit. </li>
 <li> It exits 0. </li>
</ul>

<h2> Exit codes </h2>

<ul>
 <li> 0: success </li>
 <li> 100: wrong usage </li>
 <li> 111: system call failed </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-X</tt>&nbsp;: don't wait. <tt>s6-svunlink</tt> will exit right
away, without waiting for the supervisor to exit first. </li>
 <li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if the supervisor has not exited
after <em>timeout</em> milliseconds, <tt>s6-svunlink</tt> will still exit.
The default is 0, meaning no time limit. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> Using <tt>s6-svunlink</tt> to stop services is a suboptimal pattern:
starting and stopping supervisors is a heavier operation than just stopping
services. The simpler, more efficient pattern is to simply perform
<a href="s6-svc.html">s6-svc -dwD <em>scandir</em><tt>/</tt><em>name</em></a>,
which only commands, and waits for, the death of the service, without
impacting the supervisor. Nevertheless, for symmetry with
<a href="s6-svlink.html">s6-svlink</a>, this program is provided. </li>
 <li> <tt>s6-svunlink</tt> is a destructor; as is, it returns 0 even in
situations that are nominal failures. For instance, it returns 0 even
if its timeout expires; the rationale is that there is no sensible action
for the user to do if this error is reported. <tt>s6-svunlink</tt> only
reports errors when they uncover a deeper problem in the system. </li>
 <li> <tt>s6-svunlink</tt> sends an <a href="s6-svscanctl.html">s6-svscanctl -an</a>
command to <em>scandir</em>, which means that the system's view of services
will be refreshed and inactive services will be killed and unsupervised.
Depending on what links exist in <em>scandir</em>, new
services may appear, and other services than <em>name</em> may disappear. </li>
</ul>

</body>
</html>