diff options
Diffstat (limited to 'riemann.fmi.uni-sofia.bg/ninit/subdirs.html')
| -rw-r--r-- | riemann.fmi.uni-sofia.bg/ninit/subdirs.html | 219 |
1 files changed, 219 insertions, 0 deletions
diff --git a/riemann.fmi.uni-sofia.bg/ninit/subdirs.html b/riemann.fmi.uni-sofia.bg/ninit/subdirs.html new file mode 100644 index 0000000..06d2dcd --- /dev/null +++ b/riemann.fmi.uni-sofia.bg/ninit/subdirs.html @@ -0,0 +1,219 @@ +<html> +<link rel="stylesheet" type="text/css" href="style.css"> +<title>subdirs</title> +<body> + +<div class="top"> +<ul class="nav"> + <li><a href="all.html">All files</a> +</ul> + +<h1>ninit special subdirs</h1> +<div class="endtop"></div> +</div> + +<table> +<td> +<ul> +<li><a href=#Default>~/default/</a></li> +<li><a href=#Ctrlaltdel>~/ctrlaltdel/</a></li> +<li><a href=#Kbreq>~/kbreq/</a></li> +</ul> + +<td> +<ul> +<li><a href=#Log>log/</a></li> +<li><a href=#Halt>~/halt/</a></li> +<li><a href=#Reboot>~/reboot/</a></li> +</ul> +</td> + +<td> +<ul> +<li><a href="#Services">How to create services</a></li> +<li><a href="#Examples">Examples</a></li> +<li><a href="#Converter"><tt>/etc/inittab</tt> -> services</li> +</ul> +</td> +</table> + +<h2>/etc/ninit</h2> +This is ninit HOME. +Everything else is below this directory. +See also <a href=man/ninit.man>ninit</a> options. + +<h2><a name=Run>~/sys/</a></h2> +This is the default home of ninit helpers. +<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt> is a +helper program which start +<a href="files.html#Run">service's</a> <tt>run</tt>. + + +<h2><a name=Ctrlaltdel>~/ctrlaltdel/</a></h2> +What should be done if <tt>Ctrl+Alt+Del</tt> is pressed? +If this directory does not exist, +nothing will happen when you press <tt>Ctrl+Alt+dDel</tt>. +Usually this is a link to <a href='#Halt'>halt</a> service. + +<h2><a name=Kbreq>~/kbreg/</a></h2> +What should be done if <tt>alt+up-arrow</tt> is pressed. If this +directory does not exist, nothing will happen when pressing the +<tt>keyboard-request</tt> (<tt>Alt+UP-Arrow</tt> under x86). +Usually this is a link to <a href='#Reboot'>reboot</a> service. + +<h2><a name="Default">~/default/</a></h2> +The services ninit starts when booting the system. If this directory +does not exist, nothing will happen at system startup. Quite bad. +<p> +You can start services also from ninit's command line. For example +if you add to <tt>lilo/grub</tt> +<pre> +init=/sbin/ninit srv1 srv2 +</pre> +then ninit starts <tt>srv1</tt> and <tt>srv2</tt> instead of +<tt>default</tt>. +<br> +See also <a href=man/ninit.man>ninit</a> options. + + +<h2><a name=Halt>~/halt/</a></h2> +The service must halt the system. If this directory does not +exist, nothing will happen when halting the system. +See also <a href=man/shutdown.man>ninit-shutdown</a>. + +<h2><a name=Reboot>~/reboot/</a></h2> +The service must reboot the system. If this directory does not exist, +nothing will happen at reboot. +See also <a href=man/shutdown.man>ninit-shutdown</a>. + +<h2><a name="Log">log/</a></h2> + +If this directory exists (within another service directory), it is +taken as a log service and ninit start it before the service. + +If the log service can not be +started, current service will block if it writes to stdout. +<p> +See also +<a href=files.html#In>in</a>, +<a href=files.html#Out>out</a> and +<a href=files.html#Log>log/</a>. + +<br> +Please, see +<a href=http://cr.yp.to/daemontools/multilog.html>daemontools</a> + for a very good logging tool. + + +<h2><a name="Services">How to create services</a></h2> +You know already the commands +<a name=Shell>sh</a>, echo, mkdir, rmdir, ln, id, mkfifo, +rm, ls, cat? +<font color=red>If not - very sorry, ninit in not for you yet!</font> +Continue to use /sbin/init! +<p> +The files depends, params, environ, wait, soflimit, pidfile +can be creted with <tt>echo</tt> or a text editor like <tt>vi/emacs</tt>. +See also <a href=files.html>here</a>. The program +<a href=man/service.man>ninit-service</a> displays a service dir nice. + +<ul> +<li>the first letter of a service must be [a-z|A-Z]</li> +<li>what start the service <tt>aW2Ute-Po</tt>? avoid such names!</li> +<li>don't use very long names</li> +<li>avoid symbolic/hard links. See the scenario: +<pre> + test -d srv && ln -s srv srv_double + nsvc -u srv + nsvc -u srv_double + nsvc -L +</pre> + What happen? Both are running :-) + </li> +<!-- +<li>don't make service <tt>poweroff</tt>. + In the future I will catch the signal SIGPWR + and it will start this service. +--> +<li>avoid also names <tt>/etc/ninit/{etc|usr|bin|var|tmp|sys}</tt> +</li> +<li>I will use for system services only the letters [a-z]. So + <tt>sys-test</tt> is good name. + </li> +</ul> + +<h2><a name=Examples>Examples</h2> +Not ready yet! See my private tar-ed +<a href=ninit-data.tar.gz>directory</a> +and <a href=ls-R.txt>list</a>. +<br> +I will show only one dnscache service. +<pre> + ls -l /etc/dnscache + -rw-r--r-- root root 8 Jan 18 2007 depends + -rw-r--r-- root root 131 Jan 17 2007 environ + lrwxrwxrwx root root 18 Jan 18 2007 in -> /etc/dnscache/seed@ + lrwxrwxrwx root root 12 Dec 20 2006 out -> ../logger/in@ + -rw-r--r-- root root 0 Dec 21 2006 respawn + lrwxrwxrwx root root 23 Jan 17 2007 run -> /usr/local/bin/dnscache@ + -rw-r--r-- root root 32 May 20 23:55 softlimit +</pre> + +<pre> + cat /etc/ninit/dnscache/depends + tynydns +</pre> + +<pre> + cat /etc/ninit/dnscache/environ + UID=208 + GID=502 + ROOT=/etc/dnscache/root + IP=127.0.0.1 + IPSEND=0.0.0.0 + CACHESIZE=286600 + DUMPCACHE=7200:dump/data + SLURPCACHE=dump/data +</pre> + +<pre> + cat /etc/ninit/dnscache/softlimit + o250 + m1500000 + d3000000 + f1000000 +</pre> + +The variable DUMPCACHE is defined in my +<a href=http://riemann.fmi.uni-sofia.bg/docs/djbdns-dumpcache.html> +djbdns-dumpcache</a> patch. + + + +<h2><a name=Converter><tt>/etc/inittab</tt> -> services</h2> + +The conveter +<a href=man/inittab.man>ninit-inittab</a> make a service +using the first field in <tt>/etc/inittab</tt>. In most cases +gettys are _1,_2,_3,_4,_5,_6. You can do +<pre> + sed -e '/getty/s/^/T/' /etc/inittab > /tmp/inittab + ninit-inittab /tmp/inittab /etc/ninit /tmp/ninit.sh + /tmp/ninit.sh +</pre> +Then your services for gettys will be _T1,_T2,_T3,_T4,_T5,_T6. +<p> +Similarly you can edit first a copy of <tt>/etc/inittab</tt> +and obtain a shell script creating services. +You can copy/exec only parts of the output script. +<p> + +See also +<a href=http://smarden.org/ipsvd/examples.html>here</a> for some +network services. The greatest rule is +<a href=#Shell>here</a>! + +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</body> +</html> |
