Skip to content
Snippets Groups Projects
Commit f9beadde authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

update 66-scandir documentation

parent 13c009e6
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ to be either the root or a branch of a <em>supervision tree</em>.
<h2> Interface </h2>
<pre>
66-scandir [ -h help ] [ -v <em>verbosity</em> ] [ -b boot ] [ -l <em>live</em> ] [ -t <em>rescan</em> ] [ -f <em>finish command</em> ] [ -e <em>environment</em> ] [ -c create ] [ -r remove ] [ -u up ] [ -d <em>signal</em> ] owner
66-scandir [ -h help ] [ -v <em>verbosity</em> ] [ -b boot ] [ -l <em>live</em> ] [ -t <em>rescan</em> ] [ -2 <em>stage2.tini</em> ] [ -3 <em>stage3</em> ] [ -e <em>environment</em> ] [ -c create ] [ -r remove ] [ -u up ] [ -s <em>signal</em> ] owner
</pre>
<p>66-scandir will handle or create the scandir at <em>live</em> for a specific
......@@ -37,13 +37,17 @@ permissions to create the necessary directories at <em>live</em>. If the
<ul>
<li> <tt>-h&nbsp;</tt>&nbsp;: print the help. </li>
<li> <tt>-v&nbsp;<em>verbosity</em></tt>&nbsp;: increase/decrease verbosity level.
0 or 1: print only error messages. 2: print warning message. Over 3: debugging mode. </li>
<li> <tt>-b&nbsp;</tt>&nbsp;: create specific files for boot. Only root
user can use this option - see below.</li>
<li> <tt>-l&nbsp;<em>live</em></tt>&nbsp;: create the scandir at <em>live</em>.Default is
<tt>/run/66</tt>. The default can be changed at compile-time by
giving the <tt>--livedir=<em>live</em></tt> option to <tt>./configure</tt>.</li>
<li> <tt>-t&nbsp;<em>rescan</em></tt>&nbsp;: perform a scan every <em>rescan</em>
milliseconds. If <em>rescan</em> is 0 (the default), automatic scans are never performed after
the first one and s6-svscan will only detect new services when told to
......@@ -51,20 +55,33 @@ permissions to create the necessary directories at <em>live</em>. If the
<a href="https://skarnet.org/software/s6/s6-svscanctl.html">66-svscanctl -a</a> command.
It is <em>strongly</em> discouraged to set
<em>rescan</em> to a positive value under 500. </li>
<li> <tt>-f&nbsp;<em>finish command</em></tt>&nbsp;: set the command to
<li> <tt>-2&nbsp;<em>stage2.tini</em></tt>&nbsp;: set the command to
execute with configurable handlers when the scandir receive a signal.
An absolute path is expected. This options is mandatory if the <em>-b</em>
has been given. If it's not specified /etc/66/stage2.tini scripts is
took by default. Without the <em>-b</em> options, this options have
no effects - see below.</li>
<li> <tt>-3&nbsp;<em>stage3</em></tt>&nbsp;: set the command script to
execute when the scandir is asked to be shutted down. An absolute path is expected.
This options is mandatory if the <em>-b</em> has been given. On other
case this options have no effects - see below.
This options is mandatory if the <em>-b</em> has been given. If it's not specified
/etc/66/stage3 scripts is took by default. Without the <em>-b</em> options, this
options have no effects - see below.</li>
<li> <tt>-e&nbsp;<em>environment</em></tt>&nbsp;: adjust the environment variable of the scandir with
variables find on the <em>environment</em> directory. It reads every files
in <em>environment</em> directory that does not begin with a dot and does
not contain the '=' character. An absolute path is expected. </li>
<li> <tt>-c&nbsp;</tt>&nbsp;: create the neccessary directories at <em>live</em>.
This option is expected to be done before trying to run the scandir by the options <em>-u</em>.</li>
<li> <tt>-r&nbsp;</tt>&nbsp;: remove the scandir directory at <em>live</em>.
The scandir must be stopped previously with the options <em>-d</em>.</li>
<li> <tt>-u&nbsp;</tt>&nbsp;: start the scandir directory at <em>live</em>. </li>
<li> <tt>-d&nbsp;<em>signal</em></tt>&nbsp;: send a <em>signal</em> to the scandir directory.
<li> <tt>-s&nbsp;<em>signal</em></tt>&nbsp;: send a <em>signal</em> to the scandir directory.
The signal can be any valid <a href="https://skarnet.org/software/s6/s6-svscanctl.html">s6-svscanctl</a>
command more some convenient sentence - see below. </li>
</ul>
......@@ -82,11 +99,11 @@ Also some convenient sentence was added to avoid to remember basic and usefull s
of command like :
<ul>
<li><tt>reload&nbsp;</tt>&nbsp;: this will send an <em>-an</em> command</li>
<li><tt>interrupt&nbsp;</tt>&nbsp;: this will send an <em>-rt</em> command</li>
<li><tt>interrupt&nbsp;</tt>&nbsp;: this will send an <em>-i</em> command</li>
<li><tt>quit&nbsp;</tt>&nbsp;: this will send an <em>-q</em> command</li>
<li><tt>halt&nbsp;</tt>&nbsp;: this will send an <em>-st</em> command</li>
<li><tt>reboot&nbsp;</tt>&nbsp;: this will send an <em>-i</em> command</li>
<li><tt>poweroff&nbsp;</tt>&nbsp;: this will send an <em>-pt</em> command</li>
<li><tt>halt&nbsp;</tt>&nbsp;: this will send an <em>-0</em> command</li>
<li><tt>reboot&nbsp;</tt>&nbsp;: this will send an <em>-6</em> command</li>
<li><tt>poweroff&nbsp;</tt>&nbsp;: this will send an <em>-7</em> command</li>
</ul></p>
<h3>Signal usage examples</h3>
......@@ -136,110 +153,100 @@ but are usefull to control the e.g shutdown process. The <em>66-scandir</em>
program will care of it and create those files at <tt>/run/66/scandir/0/.s6-svscan</tt>
directory. Depending if the <tt>-b</tt> options is passed or not to the command line,
the files will change.</p>
<p>The path of the scandir in those files is automatically define in
conjonction with the <tt>-l <em>live</em></tt> options.</p>
<h5>crash file</h5>
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
redirfd -r 0 /dev/console
redirfd -w 1 /dev/console
fdmove -c 2 1
s6-echo -- "scandir /run/66/scandir/0 crashed...
s6-echo -- "scandir /run/66/scandir/0 crashed ... "
/bin/sh -i
</pre>
<p>without the <tt>-b</tt> option</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
foreground { 66-all -v3 -l /run/66/ down }
s6-echo -- "scandir /run/66/scandir/0 crashed..."</pre>
<h5>finish file</h5>
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -S0
fdmove -c 2 1
s6-envdir .env
cd /
redirfd -w 2 /dev/console
fdmove -c 1 2
foreground { s6-svc -X -- /run/66/scandir/0/scandir-log }
unexport ?
wait r -- { }
/etc/66/stage3 $@
</pre>
<p>The last command (in our example <tt>/etc/66/stage3 @</tt>) is set
by the <tt>-f&nbsp;<em>finish command</em></tt> options given
on the command line. If your e.g <tt>finish command</tt> is <em>/usr/bin/true</em>
<pre>#!/usr/bin/execlineb -S0
/etc/66/stage3 $@</pre>
<p>The last command is set by the <tt>-3&nbsp;<em>stage3</em></tt> options given
on the command line. If your e.g <tt>stage3</tt> argument is <em>/usr/bin/true</em>
your <em>finish</em> file will be:
<pre>#!/usr/local/bin/execlineb -S0
fdmove -c 2 1
s6-envdir .env
cd /
redirfd -w 2 /dev/console
fdmove -c 1 2
foreground { s6-svc -X -- /run/66/scandir/0/scandir-log }
unexport ?
wait r -- { }
/usr/bin/true
</pre></p>
/usr/bin/true</pre></p>
<p>without the <tt>-b</tt> option</p>
<pre>#!/usr/local/bin/execlineb -S0
fdmove -c 2 1
s6-envdir .env
s6-echo -- "scandir /run/66/scandir/0 shutted down..."</pre>
<pre>#!/usr/bin/execlineb -S0
s6-echo -- "scandir /run/66/scandir/1000 shutted down..."</pre>
<h5>SIGHUP file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
foreground { 66-dbctl -v3 -l /run/66/ -d Master }
s6-svscanctl -h .
</pre>
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -h -- /run/66/scandir/0</pre>
<p>The command executed before sending a signal to the scandir is set
by the <tt>-2&nbsp;<em>stage2.tini</em></tt> options given
on the command line.</p>
<h5>SIGINT file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -6 .
s6-svscanctl -h -- /run/66/scandir/0</pre>
<h5>SIGINT file</h5>
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -6 -- /run/66/scandir/0
</pre>
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -6 -- /run/66/scandir/0</pre>
<h5>SIGQUIT file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -q -- /run/66/scandir/0</pre>
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -7 .
</pre>
s6-svscanctl -q -- /run/66/scandir/0</pre>
<h5>SIGTERM file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -t -- /run/66/scandir/0</pre>
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -t .
</pre>
s6-svscanctl -t -- /run/66/scandir/0</pre>
<h5>SIGUSR1 file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
s6-svscanctl -an .
</pre>
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -7 -- /run/66/scandir/0</pre>
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -7 -- /run/66/scandir/0</pre>
<h5>SIGUSR2 file</h5>
<p>With or without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir .env
<p>With the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { /etc/66/stage2.tini }
s6-svscanctl -O -- /run/66/scandir/0</pre>
<p>Without the <tt>-b</tt> options the file will be:</p>
<pre>#!/usr/bin/execlineb -P
foreground { 66-all -v3 -l /run/66/ down }
s6-svscanctl -0 .
</pre>
s6-svscanctl -O -- /run/66/scandir/0</pre>
<h2>Environment configuration</h2>
......@@ -273,7 +280,7 @@ example: </p>
<p>The root <tt>live</tt> (a.k.a <tt>/run/66</tt>) directory will be not
removed because an another user can still use it. In fact the <em>66-scandir</em>
will only remove the componment of the corresponding uid of the <tt>owner</tt>.</p>
<p>An running scandir can not be removed. You must stop the scandir before to
<p>A running scandir can not be removed. You must stop first the scandir to
be able to remove it.</p>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment