Index of /projects/littkit/
Name | Last Modified | Size |
---|---|---|
Parent Directory | ||
downloads | 2015-06-09 02:37 | - |
README file for LittKit, version 0.90
============================================
===== WHAT IS IT?
============================================
LittKit is a set of shellscripts to implement ordered-startup and run-once
capabilities within daemontools, daemontools-encore, and other
daemontools-inspired software.
============================================
===== WHAT IS ITS LICENSE?
============================================
LittKit is Free Software, written by Steve Litt, licensed with the Expat
License. See the COPYING file you got with your LittKit distribution, or
view web page http://directory.fsf.org/wiki/License:Expat
============================================
===== HOW DO I INSTALL IT?
============================================
Make sure you have bash or dash or some similar shell language installed on
your computer, and then install it in a directory that is:
1) On the root partition
2) On the executable path during early boot.
Installation consists of copying lk_* to the above described directory, making
them owned by root, group root, and executable by root.
============================================
===== SHOW ME THE MANIFEST.
============================================
lk_prepare
lk_runsvc
lk_runsvcs
lk_forever
lk_svcisdown
lk_killsvc
lk_killall
lk_rmdown
lk_rmdowns
============================================
===== HOW DO I LEARN MORE ABOUT THESE PROGRAMS?
============================================
Run the program with no arguments. Each of these arguments requires at least
one argument, and each of them presents you with USAGE output if run
without an argument.
============================================
===== I HEAR THIS IS A down FILE KLUDGE.
============================================
Yes it is. For its own purposes, LittKit takes over all use of files named
"down" in service directories. To return to you the control "down" files
used to give you, substitute "reallydown" files. To specify the first
service to run (which in turn runs the rest in order), put a "nodown" file
in its service directory. One directory containing both a "nodown" and a
"down" directory is a mistake, and its results are unspecified.
It should be noted that although LittKit is a kludge to use "down" files for
something other than djb's intended purpose, LittKit's use and syntax is
very straightforward and readable.
============================================
===== WHAT DOES EACH FILE DO?
============================================
lk_prepare <serviceroot>
Run this before svscanboot is started.
Example: lk_prepare /service
lk_runsvc <servicepath> [<sleepafter>]
Runs the individual service pointed to by <servicepath>, optionally sleeping
<sleepafter> seconds after starting the service. <sleepafter> defaults to 1,
0 is valid and typically works. Other positive numbers are OK. This is
typically used in a simple shellscript runing lk_runsvc for the services, in
the desired order. Occasionally this shellscript might have loops to detect
when a resource is ready.
Example: lk_runsvc /service/sshd 0
lk_runsvcs <serviceroot> [<sleepafter>]
Runs all remaining services that are down and don't contain a "reallydown" file. Run
order is unspecified. This is typically done after all individually run
services are running, usually to prevent the omission of a necessary
lk_runsvc.
Example: lk_runsvcs /service 0
lk_forever <sleeptime>
Loops forever, sleeping <sleeptime> in each iteration. I personally use one
hour, or 3600 seconds. This is used to simulate a run-once service, by
keeping it spinning forever. More sophisticated software, such as
daemontools-encore, have better ways of implementing run-once.
EXAMPLE: lk_forever 3600
lk_svcisdown <servicepath>
Uses svstat to return 0 if the service is down, 1 if it's up, 9 if the
directory doesn't exist or there's some other bizarre situation. Used
internally by lk_runsvcs, can be used externally.
EXAMPLE: if lk_svcisdown /service/sshd; then svc -u /service/sshd; fi
lk_killsvc <servicepath> [<sleepafter>]
Kills a service AND gives the directory a "down" file.
EXAMPLE: lk_killsvc /service/sshd 0
lk_killall <serviceroot>
DANGEROUS!!!!! Kills all remaining services not having a "nodown" file,
including ttys, possibly leaving your computer in a state that can't be shut
down. Use ONLY during the latter parts of shutdown, if then. I
highly recommend individual calls to lk_killsvc. Its name is very different
from lk_killsvc to prevent accidents.
EXAMPLE: lk_killsvcs
lk_rmdown <servicepath>
Diagnostic use only. Removes any "down" file in the <servicepath> directory.
lk_rmdowns <servicepath>
Diagnostic use only. Removes all "down" files in the directories below <serviceroot>.
============================================
===== SHOW ME AN EXAMPLE RUN SCRIPT FOR THE "nodown" SERVICE
============================================
#!/bin/sh
initialsleep=0
sleepafter=0
sleep $initialsleep
lk_runsvc /service/tty2 $sleepafter
lk_runsvc /service/tty3 $sleepafter
lk_runsvc /service/tty4 $sleepafter
lk_runsvc /service/tty5 $sleepafter
lk_runsvc /service/tty6 $sleepafter
lk_runsvc /service/bringup $sleepafter
lk_runsvc /service/dhclient $sleepafter
while ! /usr/local/bin/dhcpisready; do
sleep 4
echo waiting for network to come up
done
lk_runsvc /service/sshd $sleepafter
lk_runsvc /service/dbus $sleepafter
lk_runsvc /service/named $sleepafter
lk_runsvc /service/acpid $sleepafter
lk_runsvc /service/alsactl_r $sleepafter
lk_runsvc /service/cupsd $sleepafter
lk_runsvcs /service $sleepafter
lk_forever 3600
============================================
===== CAN I HAVE MORE THAN ONE nodown SERVICE
============================================
You *could*, but it's a bad idea. The whole purpose of your nodown service
is to provide order and determinancy. Multiple nodown services make startup
indeterminate.
Remember, the purpose of the nodown service is to start when svscan starts,
and bring up the services, in order, one at a time.
Proudly Served by LiteSpeed Web Server at troubleshooters.com Port 443