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 >
Text File  |  2009-11-06  |  11KB  |  427 lines

  1. .he ///__init/
  2. .fo //- # -//
  3. .po 5
  4. .rm 70
  5. .ps 72
  6. .m1 1
  7. .m2 2
  8. .m3 2
  9. .m4 7
  10. .ce
  11. __INIT
  12.  
  13. .cl 0 Introduction
  14. .ul
  15. Introduction
  16.  
  17. .in +5
  18.     The __init process should be the last program in the startup
  19. script.  __init handles various things, such as logon procedures, adding
  20. or removeing processes from the system as necessary.  The __init process
  21. runs in three stages.  The first stage is the boot-time.  At this stage
  22. __init starts usally demons or processes to initilize the system.  The
  23. second stage is the normal run stage.  At this time, mostly login
  24. processes for terminal lines are started.  The third stage is the
  25. powerfail condition.  On this stage, all running processes are killed
  26. and __init terminates. 
  27.  
  28. On the run-stage, __init knows about different states, called
  29. .bold
  30. runlevel
  31. where each has a different task given by the system administrator. These
  32. runlevels are numbered from 0 to 6. There are also the runlevels a, b, c
  33. and s. In a typical system, runlevel 1 may connect all staff terminal
  34. lines, runlevel 2 will do this for inhouse lines, etc. The s runlevel is
  35. a special kind of runlevel, called single user mode. The special
  36. runlevels a, b and c will be explained later.
  37. .in -5
  38.  
  39. .cl 0 General
  40. .ul
  41. General
  42.  
  43. .in +5
  44.     __init reads on startup a script file where all actions are
  45. mentioned. In the
  46. .bold
  47. boot-stage
  48. __init starts all processes which should run at boot time and tries to get
  49. the runlevel in which __init should change at run stage. This can be found
  50. in an entry in the scriptfile or the administartor will be prompted for
  51. it. After finishing the boot-stage, __init changes to
  52. .bold
  53. run-stage
  54. with the runlevel got in the boot-stage. Every process that may run at
  55. this runlevel is then started. There may be various actions for each
  56. process, such as restart it on termination, start it only once etc. To
  57. change the runlevel you have to call
  58. .bold
  59. __init
  60. with the new runlevel. This can been one of 0 to 6, a, b, c or s. __init
  61. knows also the command q, which forces the demon to re-read the script
  62. and change process states, if the script has chenged. __init t may force
  63. a powerfail and all processes for powerfail handling will d#be started,
  64. all other processes will be killed. Then __init waits for terminating of
  65. the powerfail processes and exits then.
  66.  
  67.     When __init kills an process, it send first a SIGHUP (sig #4),
  68. then waits for 10 seconds to let the process clean up his mess and
  69. terminate. After the 10 seconds, the porcess will be killed with SIGKILL
  70. (sig #0).
  71. .in -5
  72. .page
  73. .cl 0 The Scriptfile
  74. .ul
  75. The Scriptfile
  76.  
  77. .in +5
  78.     The file has the name 
  79. .bold
  80. inittab
  81. and is located in the SYS directory on the boot drive. Every empty line
  82. or every line which starts with a `#` or an `*` will be ignored as a
  83. comment. Every other line will be parsed and inserted in the internal
  84. entry list. Each line looks like this:
  85. .ce
  86. id:runlevel:device:action:command # comment
  87.  
  88. .in +5
  89. .cl 1 Field Id.
  90. .ul
  91. Field Id
  92. .in +5
  93. This is a uniqe ID for this entry. This ID should be at least two
  94. character large and may not exceed four character. On this entry, __init
  95. will recognize different entries.
  96. .in -5
  97.  
  98. .cl 1 Field Runlevel.
  99. .ul
  100. Field Runlevel
  101. .in +5
  102. This field specifies the runlevel on which the process should be
  103. started.  If __init is in boot-stage or powerfail-stage, then this entry
  104. will be ignored (expect the initdefault entry).  As possible runlevel
  105. are allowed:
  106. .in +2
  107. .nf
  108. .nj
  109. s:       Single User mode
  110. a, b, c: Extend runlevel to a, b, c
  111. 0-6:     Runlevel
  112. .fill
  113. .justify
  114. .in -2
  115. Several runlevels may be mixed up, but there are some restirctions. Only
  116. one entry for single user mode is allowed; the single user mode must not
  117. mixed with other runlevels.
  118. .in -5
  119.  
  120. .cl 1 Field Device.
  121. .ul
  122. Field Device
  123. .in +5
  124. This field specifies the device on which the process should be assigned
  125. to. If no device is given, the process runs on the null-device (/nil).
  126. A single character may be put in front of the deivce to manage the
  127. locking of this device. Possible are `l`, `L`, `+` and `e`. Using `l`
  128. __init will lock the device with a unique number and if some other
  129. process will lock this device, __init will kill the process running on
  130. this device and free it. `L` will lock the device for this process only.
  131. No ther process will get this device, unless the process dies (see also
  132. the docomentation for sysinfo and locking with sysinfo). `+` tells __init
  133. that this process is a login process. __init will then handle the
  134. /dd/SYS/utmp file correctly (deleting old entries). When the device is
  135. locked and `e` is specified, then the process will not be started.
  136.  
  137. In front of the device and the locking information, there may be a
  138. number. Normally __init kills a process with SIGHUP, waits 10 seconds and
  139. kill it then with SIGKILL. If you want to send another signal than
  140. SIGHUP, this number will be taken as the desired signal.
  141. .in -5
  142.  
  143. .cl 1 Field Action.
  144. .ul
  145. Field Action
  146.  
  147. .in +5
  148. The action field specifies in which stage the process is started and if
  149. the process is respawned. For boot-stage, possible actions are
  150. .in +2
  151. .cl 2 Initdefault
  152. .ul
  153. initdefault
  154. .in +2
  155. This is not a real "action". When changing to run-stage, the runlevel
  156. specified here will be taken as the current runlevel. If no initdefault
  157. is given, the administartor is prompted for the runlevel. In the process
  158. field there may be a list of devices. This is useful to initialize the
  159. /dd/SYS/utmp file for future use. All devices with a logon entry should
  160. be list here.
  161. .in -2
  162.  
  163. .cl 2 Sysinit
  164. .ul
  165. sysinit
  166. .in +2
  167. This is handled like bootwait. But this will executed as the first
  168. process by inittab. Normally used to do some tasks to initialize the
  169. console (e.g. load a new Driver).
  170. .in -2
  171.  
  172. .cl 2 Source
  173. .ul
  174. source
  175. .in +2
  176. The process field have to be a filename where several enviroment
  177. settings are stored. The format of each line ist <var>=<value>. If a
  178. setting has the format <var> then the enviroment variable <var> ist
  179. removed from the list.
  180. .in -2
  181.  
  182. .cl 2 Enviroment
  183. .ul
  184. enviroment
  185. .in +2
  186. The process field have to contain exactly one enviroment varibale. The
  187. format is the same as specified in source.
  188. .in -2
  189.  
  190. .cl 2 Boot
  191. .ul
  192. boot
  193. .in +2
  194. This process will be started and __init don't wait for its termination.
  195. Typically, demons like cron will be started with this action.
  196. .in -2
  197.  
  198. .cl 2 Bootwait
  199. .ul
  200. bootwait
  201. .in +2
  202. The process is started and __init waits for its termination. Usally used
  203. to start some processes for initialtion.
  204. .in -4
  205.  
  206. On run-stage there are these actions:
  207. .in +2
  208. .cl 2 Once
  209. .ul
  210. once
  211. .in +2
  212. When changing to this runlevel, the process is started once and __init
  213. doesn't wait for its termination.
  214. .in -2
  215.  
  216. .cl 2 Wait
  217. .ul
  218. wait
  219. .in +2
  220. Like once, but __init waits for its termination.
  221. .in -2
  222.  
  223. .cl 2 Respawn
  224. .ul
  225. respawn
  226. .in +2
  227. The process is started and __init doesn't wait for its termination. When
  228. the process dies, then it will be restarted by __init. Usally used for
  229. login processes.
  230. .in -2
  231.  
  232. .cl 2 Ondemand
  233. .ul
  234. ondemand
  235. .in +2
  236. This is the same function as respawn, usally used by runlevel a, b or c.
  237. .in -4
  238.  
  239. On powerfail-stage there are these actions:
  240. .in +2
  241. .cl 2 Powerfail
  242. .ul
  243. powerfail
  244. .in +2
  245. The process will be started and __init doesn't wait for its termination.
  246. .in -2
  247.  
  248. .cl 2 Powerwait
  249. .ul
  250. powerwait
  251. .in +2
  252. Like powerfail, but __init waits for the termination of the process.
  253. .in -4
  254.  
  255. There is one action, which can be used everywhere and is used to disable
  256. an action without deleting it from the inittab. The
  257. .cl 2 Off
  258. .ul
  259. off
  260. action is also often used to insert a comment for a device in the
  261. inittab without a process assigned to this device.
  262. .in -5
  263.  
  264. .cl 1 Field Process.
  265. .ul
  266. Field Process
  267.  
  268. .in +5
  269. Here is the process which should be started if all conditions are ok.
  270. They are directly forked, not using are shell. If you have anywhere an
  271. unquoted `#` follow by a space, the rest of the line will be taken as a
  272. comment and will be ignored.
  273. .in -15
  274.  
  275. .cl 0 Aliases
  276. .ul
  277. Aliases
  278.  
  279. .in +5
  280. __init allows to alias the runlevels when changing to them. The file
  281. .bold
  282. inittab.alias
  283. in the SYS directory of your bootdevice contains the aliases. Every line
  284. represent an alias and has the form
  285. .bold
  286. alias runlevel
  287. e.g.
  288. .in +15
  289. single s
  290. .in -15
  291. allows to type
  292. .bold
  293. __init single
  294. to change to single user mode.
  295. .in -5
  296.  
  297. .cl 0 Instalation
  298. .ul
  299. Instalation
  300.  
  301. .in +5
  302.     To install __init on your System, insert in the Sysinfo file the
  303. line
  304. .bold
  305. lck.init,l
  306. to enable the locking for __init. Copy __init to the CMDS directory on
  307. your bootdevice and edit the File inittab in the SYS directory on your
  308. bootdevice. Edit then the startup file in the root directory of your
  309. bootdevice. The last line should be
  310. .bold
  311. ex __init
  312. to start __init with the same PID as the startup shell. Whene everything
  313. runs ok, you can edit the file inittab.alias in the SYS directory of
  314. your bootdevice.
  315. .in -5
  316.  
  317. .cl 0 Example
  318. .ul
  319. Example
  320.  
  321. .in +5
  322.     As an example, this is a complete inittab-file.  You can use it,
  323. as it is, but normally you have to make some changes to make it run
  324. properly on your system.
  325. .cl 1 Example Inittab
  326. .in +2
  327. .nf
  328. .nj
  329. #       INITTAB Example for an Atari-ST running OS9/68000
  330. #       V2.2 with virtual terminals.
  331. #
  332. #       Runlevel nach boot: 0
  333. #
  334. id:0::initdefault:/term /term1 /term2
  335. #
  336. #    Starting VCron in boot-stage
  337. #
  338. vc::/term:bootwait:vcron
  339. #
  340. #       Configure serial and midi Port
  341. #
  342. b0:::bootwait:xmode /t1 baud=1200 xoff=0 xon=0
  343. b1:::bootwait:xmode /t2 nopause
  344. #
  345. #       Start watch once after boot
  346. #
  347. w0::3:once:watch /t1
  348. #
  349. #       Virtual terminals
  350. #
  351. c0::+/term:respawn:logon -jts
  352. c1::+/term1:respawn:logon -jts
  353. c2::+/term2:respawn:logon -jts
  354. c3::+/term3:respawn:logon -jts
  355. c4::+/term4:respawn:logon -jts
  356. c5::+/term5:respawn:logon -jts
  357. c6::+/term6:respawn:logon -jts
  358. #
  359. #        another Terminal on runlevel 1
  360. c7:16:+/term7:respawn:logon -jts
  361. #
  362. #       serieal mmon on runmlevel 2
  363. #
  364. s1:26:12:once:mmon -x -m -nf /t1 -lo=lc -s
  365. #
  366. #       Logon on midi port on runlevel 3
  367. #
  368. s2:36:+/t2:respawn:logon -jts
  369. #
  370. #       On powerfail
  371. #
  372. p0::/term:powerwait:echo POWERFAIL
  373. .fill
  374. .justify
  375. .in -2
  376.  
  377. Another example for the inittab.alias file
  378. .cl 1 Example Inittab.alias
  379. .in +2
  380. .nj
  381. .nf
  382. single  s
  383. normal  0
  384. full    1
  385. modem   2
  386. midi    3
  387. all     6
  388. .fill
  389. .justify
  390. .in -2
  391. .in -5
  392.  
  393. .cl 0 Options
  394. .ul
  395. Options
  396.  
  397. .in +5
  398. __init supports the following options:
  399. .in +2
  400. -?
  401. .in +5
  402. Gives a short help over the usage and options of __init.
  403. .in -5
  404. -f
  405. .in +5
  406. This is the
  407. .ul
  408. fast
  409. option. This option has only an efect when __init is running as a demon.
  410. Normally, __init kills an process with SIGHUP or a specified signal,
  411. waits about 20 seconds for his death, and if still alive, it kills the
  412. process with SIGKILL. If the fastoption is selected, every process
  413. receives a signal SIGHUP (or specified) and then __init waits 20
  414. seconds. Then all still found processes are killed with SIGKILL.
  415. .in -5
  416. -nf
  417. .in +5
  418. This switches of the fast option. At starttime, fast isn't selected.
  419. .in -5
  420. .in -2
  421. .in -5
  422. .page
  423. .ce
  424. Contens
  425. .pc
  426.