s6-svunlink.html (3816B)
1 <html> 2 <head> 3 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <meta http-equiv="Content-Language" content="en" /> 6 <title>s6: the s6-svunlink program</title> 7 <meta name="Description" content="s6: the s6-svunlink program" /> 8 <meta name="Keywords" content="s6 command s6-svunlink supervision service stop unlink scandir servicedir" /> 9 <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> 10 </head> 11 <body> 12 13 <p> 14 <a href="index.html">s6</a><br /> 15 <a href="//skarnet.org/software/">Software</a><br /> 16 <a href="//skarnet.org/">skarnet.org</a> 17 </p> 18 19 <h1> The s6-svunlink program </h1> 20 21 <p> 22 <tt>s6-svunlink</tt> unlinks a <a href="servicedir.html">service 23 directory</a> from a <a href="scandir.html">scan directory</a>, then 24 notifies <a href="s6-svscan.html">s6-svscan</a> that a service has 25 been unregistered. It waits until the <a href="s6-supervise.html">s6-supervise</a> 26 supervisor process managing the service has disappeared, then exits. 27 </p> 28 29 <p> 30 The point of <tt>s6-svunlink</tt> is to help integrate 31 service directories into an existing service manager sequence and 32 eliminate race conditions. 33 </p> 34 35 <h2> Interface </h2> 36 37 <pre> 38 s6-svunlink [ -X ] [ -t <em>timeout</em> ] <em>scandir</em> <em>name</em> 39 </pre> 40 41 <ul> 42 <li> <tt>s6-svunlink</tt> expects a running <a href="s6-svscan.html">s6-svscan</a> 43 process on <em>scandir</em> and a fully functional supervised service on 44 <a href="servicedir.html">service directory</a> in <em>scandir</em><tt>/</tt><em>name</em>, 45 which must be a symbolic link to a real directory located somewhere else. </li> 46 <li> It deletes the <em>scandir</em><tt>/</tt><em>name</em> symlink. </li> 47 <li> It sends a command to <a href="s6-svscan.html">s6-svscan</a> to signal it 48 that a service has disappeared. </li> 49 <li> It waits for the <a href="s6-supervise.html">s6-supervise</a> process 50 managing the service directory to exit. </li> 51 <li> It exits 0. </li> 52 </ul> 53 54 <h2> Exit codes </h2> 55 56 <ul> 57 <li> 0: success </li> 58 <li> 100: wrong usage </li> 59 <li> 111: system call failed </li> 60 </ul> 61 62 <h2> Options </h2> 63 64 <ul> 65 <li> <tt>-X</tt> : don't wait. <tt>s6-svunlink</tt> will exit right 66 away, without waiting for the supervisor to exit first. </li> 67 <li> <tt>-t <em>timeout</em></tt> : if the supervisor has not exited 68 after <em>timeout</em> milliseconds, <tt>s6-svunlink</tt> will still exit. 69 The default is 0, meaning no time limit. </li> 70 </ul> 71 72 <h2> Notes </h2> 73 74 <ul> 75 <li> Using <tt>s6-svunlink</tt> to stop services is a suboptimal pattern: 76 starting and stopping supervisors is a heavier operation than just stopping 77 services. The simpler, more efficient pattern is to simply perform 78 <a href="s6-svc.html">s6-svc -dwD <em>scandir</em><tt>/</tt><em>name</em></a>, 79 which only commands, and waits for, the death of the service, without 80 impacting the supervisor. Nevertheless, for symmetry with 81 <a href="s6-svlink.html">s6-svlink</a>, this program is provided. </li> 82 <li> <tt>s6-svunlink</tt> is a destructor; as is, it returns 0 even in 83 situations that are nominal failures. For instance, it returns 0 even 84 if its timeout expires; the rationale is that there is no sensible action 85 for the user to do if this error is reported. <tt>s6-svunlink</tt> only 86 reports errors when they uncover a deeper problem in the system. </li> 87 <li> <tt>s6-svunlink</tt> sends an <a href="s6-svscanctl.html">s6-svscanctl -an</a> 88 command to <em>scandir</em>, which means that the system's view of services 89 will be refreshed and inactive services will be killed and unsupervised. 90 Depending on what links exist in <em>scandir</em>, new 91 services may appear, and other services than <em>name</em> may disappear. </li> 92 </ul> 93 94 </body> 95 </html>