home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
TOP
/
USR
/
MAN
/
init.prf
< prev
next >
Wrap
Text File
|
2009-11-06
|
11KB
|
427 lines
.he ///__init/
.fo //- # -//
.po 5
.rm 70
.ps 72
.m1 1
.m2 2
.m3 2
.m4 7
.ce
__INIT
.cl 0 Introduction
.ul
Introduction
.in +5
The __init process should be the last program in the startup
script. __init handles various things, such as logon procedures, adding
or removeing processes from the system as necessary. The __init process
runs in three stages. The first stage is the boot-time. At this stage
__init starts usally demons or processes to initilize the system. The
second stage is the normal run stage. At this time, mostly login
processes for terminal lines are started. The third stage is the
powerfail condition. On this stage, all running processes are killed
and __init terminates.
On the run-stage, __init knows about different states, called
.bold
runlevel
where each has a different task given by the system administrator. These
runlevels are numbered from 0 to 6. There are also the runlevels a, b, c
and s. In a typical system, runlevel 1 may connect all staff terminal
lines, runlevel 2 will do this for inhouse lines, etc. The s runlevel is
a special kind of runlevel, called single user mode. The special
runlevels a, b and c will be explained later.
.in -5
.cl 0 General
.ul
General
.in +5
__init reads on startup a script file where all actions are
mentioned. In the
.bold
boot-stage
__init starts all processes which should run at boot time and tries to get
the runlevel in which __init should change at run stage. This can be found
in an entry in the scriptfile or the administartor will be prompted for
it. After finishing the boot-stage, __init changes to
.bold
run-stage
with the runlevel got in the boot-stage. Every process that may run at
this runlevel is then started. There may be various actions for each
process, such as restart it on termination, start it only once etc. To
change the runlevel you have to call
.bold
__init
with the new runlevel. This can been one of 0 to 6, a, b, c or s. __init
knows also the command q, which forces the demon to re-read the script
and change process states, if the script has chenged. __init t may force
a powerfail and all processes for powerfail handling will d#be started,
all other processes will be killed. Then __init waits for terminating of
the powerfail processes and exits then.
When __init kills an process, it send first a SIGHUP (sig #4),
then waits for 10 seconds to let the process clean up his mess and
terminate. After the 10 seconds, the porcess will be killed with SIGKILL
(sig #0).
.in -5
.page
.cl 0 The Scriptfile
.ul
The Scriptfile
.in +5
The file has the name
.bold
inittab
and is located in the SYS directory on the boot drive. Every empty line
or every line which starts with a `#` or an `*` will be ignored as a
comment. Every other line will be parsed and inserted in the internal
entry list. Each line looks like this:
.ce
id:runlevel:device:action:command # comment
.in +5
.cl 1 Field Id.
.ul
Field Id
.in +5
This is a uniqe ID for this entry. This ID should be at least two
character large and may not exceed four character. On this entry, __init
will recognize different entries.
.in -5
.cl 1 Field Runlevel.
.ul
Field Runlevel
.in +5
This field specifies the runlevel on which the process should be
started. If __init is in boot-stage or powerfail-stage, then this entry
will be ignored (expect the initdefault entry). As possible runlevel
are allowed:
.in +2
.nf
.nj
s: Single User mode
a, b, c: Extend runlevel to a, b, c
0-6: Runlevel
.fill
.justify
.in -2
Several runlevels may be mixed up, but there are some restirctions. Only
one entry for single user mode is allowed; the single user mode must not
mixed with other runlevels.
.in -5
.cl 1 Field Device.
.ul
Field Device
.in +5
This field specifies the device on which the process should be assigned
to. If no device is given, the process runs on the null-device (/nil).
A single character may be put in front of the deivce to manage the
locking of this device. Possible are `l`, `L`, `+` and `e`. Using `l`
__init will lock the device with a unique number and if some other
process will lock this device, __init will kill the process running on
this device and free it. `L` will lock the device for this process only.
No ther process will get this device, unless the process dies (see also
the docomentation for sysinfo and locking with sysinfo). `+` tells __init
that this process is a login process. __init will then handle the
/dd/SYS/utmp file correctly (deleting old entries). When the device is
locked and `e` is specified, then the process will not be started.
In front of the device and the locking information, there may be a
number. Normally __init kills a process with SIGHUP, waits 10 seconds and
kill it then with SIGKILL. If you want to send another signal than
SIGHUP, this number will be taken as the desired signal.
.in -5
.cl 1 Field Action.
.ul
Field Action
.in +5
The action field specifies in which stage the process is started and if
the process is respawned. For boot-stage, possible actions are
.in +2
.cl 2 Initdefault
.ul
initdefault
.in +2
This is not a real "action". When changing to run-stage, the runlevel
specified here will be taken as the current runlevel. If no initdefault
is given, the administartor is prompted for the runlevel. In the process
field there may be a list of devices. This is useful to initialize the
/dd/SYS/utmp file for future use. All devices with a logon entry should
be list here.
.in -2
.cl 2 Sysinit
.ul
sysinit
.in +2
This is handled like bootwait. But this will executed as the first
process by inittab. Normally used to do some tasks to initialize the
console (e.g. load a new Driver).
.in -2
.cl 2 Source
.ul
source
.in +2
The process field have to be a filename where several enviroment
settings are stored. The format of each line ist <var>=<value>. If a
setting has the format <var> then the enviroment variable <var> ist
removed from the list.
.in -2
.cl 2 Enviroment
.ul
enviroment
.in +2
The process field have to contain exactly one enviroment varibale. The
format is the same as specified in source.
.in -2
.cl 2 Boot
.ul
boot
.in +2
This process will be started and __init don't wait for its termination.
Typically, demons like cron will be started with this action.
.in -2
.cl 2 Bootwait
.ul
bootwait
.in +2
The process is started and __init waits for its termination. Usally used
to start some processes for initialtion.
.in -4
On run-stage there are these actions:
.in +2
.cl 2 Once
.ul
once
.in +2
When changing to this runlevel, the process is started once and __init
doesn't wait for its termination.
.in -2
.cl 2 Wait
.ul
wait
.in +2
Like once, but __init waits for its termination.
.in -2
.cl 2 Respawn
.ul
respawn
.in +2
The process is started and __init doesn't wait for its termination. When
the process dies, then it will be restarted by __init. Usally used for
login processes.
.in -2
.cl 2 Ondemand
.ul
ondemand
.in +2
This is the same function as respawn, usally used by runlevel a, b or c.
.in -4
On powerfail-stage there are these actions:
.in +2
.cl 2 Powerfail
.ul
powerfail
.in +2
The process will be started and __init doesn't wait for its termination.
.in -2
.cl 2 Powerwait
.ul
powerwait
.in +2
Like powerfail, but __init waits for the termination of the process.
.in -4
There is one action, which can be used everywhere and is used to disable
an action without deleting it from the inittab. The
.cl 2 Off
.ul
off
action is also often used to insert a comment for a device in the
inittab without a process assigned to this device.
.in -5
.cl 1 Field Process.
.ul
Field Process
.in +5
Here is the process which should be started if all conditions are ok.
They are directly forked, not using are shell. If you have anywhere an
unquoted `#` follow by a space, the rest of the line will be taken as a
comment and will be ignored.
.in -15
.cl 0 Aliases
.ul
Aliases
.in +5
__init allows to alias the runlevels when changing to them. The file
.bold
inittab.alias
in the SYS directory of your bootdevice contains the aliases. Every line
represent an alias and has the form
.bold
alias runlevel
e.g.
.in +15
single s
.in -15
allows to type
.bold
__init single
to change to single user mode.
.in -5
.cl 0 Instalation
.ul
Instalation
.in +5
To install __init on your System, insert in the Sysinfo file the
line
.bold
lck.init,l
to enable the locking for __init. Copy __init to the CMDS directory on
your bootdevice and edit the File inittab in the SYS directory on your
bootdevice. Edit then the startup file in the root directory of your
bootdevice. The last line should be
.bold
ex __init
to start __init with the same PID as the startup shell. Whene everything
runs ok, you can edit the file inittab.alias in the SYS directory of
your bootdevice.
.in -5
.cl 0 Example
.ul
Example
.in +5
As an example, this is a complete inittab-file. You can use it,
as it is, but normally you have to make some changes to make it run
properly on your system.
.cl 1 Example Inittab
.in +2
.nf
.nj
# INITTAB Example for an Atari-ST running OS9/68000
# V2.2 with virtual terminals.
#
# Runlevel nach boot: 0
#
id:0::initdefault:/term /term1 /term2
#
# Starting VCron in boot-stage
#
vc::/term:bootwait:vcron
#
# Configure serial and midi Port
#
b0:::bootwait:xmode /t1 baud=1200 xoff=0 xon=0
b1:::bootwait:xmode /t2 nopause
#
# Start watch once after boot
#
w0::3:once:watch /t1
#
# Virtual terminals
#
c0::+/term:respawn:logon -jts
c1::+/term1:respawn:logon -jts
c2::+/term2:respawn:logon -jts
c3::+/term3:respawn:logon -jts
c4::+/term4:respawn:logon -jts
c5::+/term5:respawn:logon -jts
c6::+/term6:respawn:logon -jts
#
# another Terminal on runlevel 1
#
c7:16:+/term7:respawn:logon -jts
#
# serieal mmon on runmlevel 2
#
s1:26:12:once:mmon -x -m -nf /t1 -lo=lc -s
#
# Logon on midi port on runlevel 3
#
s2:36:+/t2:respawn:logon -jts
#
# On powerfail
#
p0::/term:powerwait:echo POWERFAIL
.fill
.justify
.in -2
Another example for the inittab.alias file
.cl 1 Example Inittab.alias
.in +2
.nj
.nf
single s
normal 0
full 1
modem 2
midi 3
all 6
.fill
.justify
.in -2
.in -5
.cl 0 Options
.ul
Options
.in +5
__init supports the following options:
.in +2
-?
.in +5
Gives a short help over the usage and options of __init.
.in -5
-f
.in +5
This is the
.ul
fast
option. This option has only an efect when __init is running as a demon.
Normally, __init kills an process with SIGHUP or a specified signal,
waits about 20 seconds for his death, and if still alive, it kills the
process with SIGKILL. If the fastoption is selected, every process
receives a signal SIGHUP (or specified) and then __init waits 20
seconds. Then all still found processes are killed with SIGKILL.
.in -5
-nf
.in +5
This switches of the fast option. At starttime, fast isn't selected.
.in -5
.in -2
.in -5
.page
.ce
Contens
.pc