s6-svwait.html (4591B)
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-svwait program</title> 7 <meta name="Description" content="s6: the s6-svwait program" /> 8 <meta name="Keywords" content="s6 command s6-svwait notification service waiting" /> 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-svwait program </h1> 20 21 <p> 22 s6-svwait blocks until a collection of supervised services goes up, or down. 23 </p> 24 25 <p> 26 s6-svwait only waits for notifications; it never polls. 27 </p> 28 29 <h2> Interface </h2> 30 31 <pre> 32 s6-svwait [ -U | -u | -D | -d | -r | -R ] [ -a | -o ] [ -t <em>timeout</em> ] <em>servicedir...</em> 33 </pre> 34 35 <p> 36 s6-svwait monitors one or more <a href="servicedir.html">service 37 directories</a> given as its arguments, waiting for a state (ready, up or down) to 38 happen. If no service directories are listed, it immediately exits 0. 39 </p> 40 41 <h2> Exit codes </h2> 42 43 <ul> 44 <li> 0: success, the wanted state has been reached </li> 45 <li> 99: timed out </li> 46 <li> 100: wrong usage </li> 47 <li> 102: the <a href="s6-supervise.html">s6-supervise</a> process monitoring the service died </li> 48 <li> 111: system call failed </li> 49 <li> <em>n</em>: services were expected to come up, but <em>n</em> of them 50 reported permanent failure </li> 51 </ul> 52 53 <h2> Options </h2> 54 55 <ul> 56 <li> <tt>-u</tt> : up. s6-svwait will wait until the services are up, as 57 reported by s6-supervise. 58 This is the default; it is not reliable, but it does not depend on specific 59 support in the service programs. See <a href="notifywhenup.html">this page</a> 60 for details. </li> 61 <li> <tt>-U</tt> : really up. s6-svwait will wait until the services are 62 up <em>and</em> ready as reported by the services themselves. This requires 63 specific support in the service programs, and the use of the 64 <tt>notification-fd</tt> file in the 65 <a href="servicedir.html">service directory</a>. 66 See the explanation on <a href="notifywhenup.html">this page</a>. </li> 67 <li> <tt>-d</tt> : down. s6-svwait will wait until the services are down. </li> 68 <li> <tt>-D</tt> : really down. s6-svwait will wait until the 69 services are down and the cleanup scripts in 70 <tt><em>servicedir</em>/finish</tt> 71 for every <em>servicedir</em> 72 have finished executing (or have timed out and been killed). </li> 73 <li> <tt>-r</tt> : restart. s6-svwait will wait until the services 74 are down, then until they are up. If the <tt>-o</tt> option is given, it 75 waits until <em>all</em> services are down and <em>one</em> service is up; 76 otherwise it waits until <em>all</em> the services have restarted. </li> 77 <li> <tt>-R</tt> : restart and ready.. s6-svwait will wait until the services 78 are down, then until they are up and ready. If the <tt>-o</tt> option is given, it 79 waits until <em>all</em> services are down and <em>one</em> service is up and 80 ready; otherwise it waits until <em>all</em> the services have restarted and 81 are ready. </li> 82 <li> <tt>-o</tt> : or. s6-svwait will wait until <em>one</em> of the 83 given services comes up or down. </li> 84 <li> <tt>-a</tt> : and. s6-svwait will wait until <em>all</em> of the 85 given services come up or down. This is the default. </li> 86 <li> <tt>-t <em>timeout</em></tt> : if the requested events have not 87 happened after <em>timeout</em> milliseconds, s6-svwait will print a message 88 to stderr and exit 99. By default, <em>timeout</em> is 0, which means no time 89 limit. </li> 90 </ul> 91 92 <h2> Notes </h2> 93 94 <ul> 95 <li> s6-svwait should be given one or more <em>service directories</em> as 96 arguments, not a <em>scan directory</em>. If you need to wait for a whole 97 scan directory, give all its contents as arguments to s6-svwait. </li> 98 <li> s6-svwait will only work on service directories that are already 99 active, i.e. have an <a href="s6-supervise.html">s6-supervise</a> process 100 running on them. It will not work on a service directory where 101 s6-supervise has not been started yet. </li> 102 </ul> 103 104 <h2> Internals </h2> 105 106 <p> 107 s6-svwait spawns a <a href="libs6/s6-ftrigrd.html">s6-ftrigrd</a> child to 108 listen to notifications sent by <a href="s6-supervise.html">s6-supervise</a>. 109 It also checks <tt>supervise/status</tt> files to get the current service 110 states, so it is immune to race conditions. 111 </p> 112 113 </body> 114 </html>