1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
|
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2010-10-22 00:40+0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(abstract):11
msgid "Gentoo uses a special initscript format which, amongst other features, allows dependency-driven decisions and virtual initscripts. This chapter explains all these aspects and explains how to deal with these scripts."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(version):17
msgid "1.25"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(date):18
msgid "2007-10-11"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):21
msgid "Runlevels"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):23
msgid "Booting your System"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):26
msgid "When you boot your system, you will notice lots of text floating by. If you pay close attention, you will notice this text is the same every time you reboot your system. The sequence of all these actions is called the <e>boot sequence</e> and is (more or less) statically defined."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):33
msgid "First, your boot loader will load the kernel image you have defined in the boot loader configuration into memory after which it tells the CPU to run the kernel. When the kernel is loaded and run, it initializes all kernel-specific structures and tasks and starts the <c>init</c> process."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):40
msgid "This process then makes sure that all filesystems (defined in <path>/etc/fstab</path>) are mounted and ready to be used. Then it executes several scripts located in <path>/etc/init.d</path>, which will start the services you need in order to have a successfully booted system."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):47
msgid "Finally, when all scripts are executed, <c>init</c> activates the terminals (in most cases just the virtual consoles which are hidden beneath <c>Alt-F1</c>, <c>Alt-F2</c>, etc.) attaching a special process called <c>agetty</c> to it. This process will then make sure you are able to log on through these terminals by running <c>login</c>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):58
msgid "Init Scripts"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):61
msgid "Now <c>init</c> doesn't just execute the scripts in <path>/etc/init.d</path> randomly. Even more, it doesn't run all scripts in <path>/etc/init.d</path>, only the scripts it is told to execute. It decides which scripts to execute by looking into <path>/etc/runlevels</path>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):68
msgid "First, <c>init</c> runs all scripts from <path>/etc/init.d</path> that have symbolic links inside <path>/etc/runlevels/boot</path>. Usually, it will start the scripts in alphabetical order, but some scripts have dependency information in them, telling the system that another script must be run before they can be started."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):76
msgid "When all <path>/etc/runlevels/boot</path> referenced scripts are executed, <c>init</c> continues with running the scripts that have a symbolic link to them in <path>/etc/runlevels/default</path>. Again, it will use the alphabetical order to decide what script to run first, unless a script has dependency information in it, in which case the order is changed to provide a valid start-up sequence."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):88
msgid "How Init Works"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):91
msgid "Of course <c>init</c> doesn't decide all that by itself. It needs a configuration file that specifies what actions need to be taken. This configuration file is <path>/etc/inittab</path>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):97
msgid "If you remember the boot sequence we have just described, you will remember that <c>init</c>'s first action is to mount all filesystems. This is defined in the following line from <path>/etc/inittab</path>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):103
msgid "The system initialisation line in /etc/inittab"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):103
#, no-wrap
msgid "\nsi::sysinit:/sbin/rc sysinit\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):107
msgid "This line tells <c>init</c> that it must run <c>/sbin/rc sysinit</c> to initialize the system. The <path>/sbin/rc</path> script takes care of the initialisation, so you might say that <c>init</c> doesn't do much -- it delegates the task of initialising the system to another process."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):114
msgid "Second, <c>init</c> executed all scripts that had symbolic links in <path>/etc/runlevels/boot</path>. This is defined in the following line:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):119
msgid "The system initialisation, continued"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):119
#, no-wrap
msgid "\nrc::bootwait:/sbin/rc boot\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):123
msgid "Again the <c>rc</c> script performs the necessary tasks. Note that the option given to <c>rc</c> (<e>boot</e>) is the same as the subdirectory of <path>/etc/runlevels</path> that is used."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):129
msgid "Now <c>init</c> checks its configuration file to see what <e>runlevel</e> it should run. To decide this, it reads the following line from <path>/etc/inittab</path>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):135
msgid "The initdefault line"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):135
#, no-wrap
msgid "\nid:3:initdefault:\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):139
msgid "In this case (which the majority of Gentoo users will use), the <e>runlevel</e> id is 3. Using this information, <c>init</c> checks what it must run to start <e>runlevel 3</e>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):145
msgid "The runlevel definitions"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):145
#, no-wrap
msgid "\nl0:0:wait:/sbin/rc shutdown\nl1:S1:wait:/sbin/rc single\nl2:2:wait:/sbin/rc nonetwork\nl3:3:wait:/sbin/rc default\nl4:4:wait:/sbin/rc default\nl5:5:wait:/sbin/rc default\nl6:6:wait:/sbin/rc reboot\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):155
msgid "The line that defines level 3, again, uses the <c>rc</c> script to start the services (now with argument <e>default</e>). Again note that the argument of <c>rc</c> is the same as the subdirectory from <path>/etc/runlevels</path>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):161
msgid "When <c>rc</c> has finished, <c>init</c> decides what virtual consoles it should activate and what commands need to be run at each console:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):166
msgid "The virtual consoles definition"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):166
#, no-wrap
msgid "\nc1:12345:respawn:/sbin/agetty 38400 tty1 linux\nc2:12345:respawn:/sbin/agetty 38400 tty2 linux\nc3:12345:respawn:/sbin/agetty 38400 tty3 linux\nc4:12345:respawn:/sbin/agetty 38400 tty4 linux\nc5:12345:respawn:/sbin/agetty 38400 tty5 linux\nc6:12345:respawn:/sbin/agetty 38400 tty6 linux\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):179
msgid "What is a runlevel?"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):182
msgid "You have seen that <c>init</c> uses a numbering scheme to decide what <e>runlevel</e> it should activate. A <e>runlevel</e> is a state in which your system is running and contains a collection of scripts (runlevel scripts or <e>initscripts</e>) that must be executed when you enter or leave a runlevel."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):189
msgid "In Gentoo, there are seven runlevels defined: three internal runlevels, and four user-defined runlevels. The internal runlevels are called <e>sysinit</e>, <e>shutdown</e> and <e>reboot</e> and do exactly what their names imply: initialize the system, powering off the system and rebooting the system."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):196
msgid "The user-defined runlevels are those with an accompanying <path>/etc/runlevels</path> subdirectory: <path>boot</path>, <path>default</path>, <path>nonetwork</path> and <path>single</path>. The <path>boot</path> runlevel starts all system-necessary services which all other runlevels use. The remaining three runlevels differ in what services they start: <path>default</path> is used for day-to-day operations, <path>nonetwork</path> is used in case no network connectivity is required, and <path>single</path> is used when you need to fix the system."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):210
msgid "Working with the Init Scripts"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):213
msgid "The scripts that the <c>rc</c> process starts are called <e>init scripts</e>. Each script in <path>/etc/init.d</path> can be executed with the arguments <e>start</e>, <e>stop</e>, <e>restart</e>, <e>pause</e>, <e>zap</e>, <e>status</e>, <e>ineed</e>, <e>iuse</e>, <e>needsme</e>, <e>usesme</e> or <e>broken</e>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):221
msgid "To start, stop or restart a service (and all depending services), <c>start</c>, <c>stop</c> and <c>restart</c> should be used:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):226
msgid "Starting Postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):226
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix start</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(note):230
msgid "Only the services that <e>need</e> the given service are stopped or restarted. The other depending services (those that <e>use</e> the service but don't need it) are left untouched."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):236
msgid "If you want to stop a service, but not the services that depend on it, you can use the <c>pause</c> argument:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):241
msgid "Stopping Postfix but keep the depending services running"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):241
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix pause</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):245
msgid "If you want to see what status a service has (started, stopped, paused, ...) you can use the <c>status</c> argument:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):250
msgid "Status information for postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):250
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix status</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):254
msgid "If the status information tells you that the service is running, but you know that it is not, then you can reset the status information to \"stopped\" with the <c>zap</c> argument:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):260
msgid "Resetting status information for postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):260
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix zap</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):264
msgid "To also ask what dependencies the service has, you can use <c>iuse</c> or <c>ineed</c>. With <c>ineed</c> you can see the services that are really necessary for the correct functioning of the service. <c>iuse</c> on the other hand shows the services that can be used by the service, but are not necessary for the correct functioning."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):272
msgid "Requesting a list of all necessary services on which Postfix depends"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):272
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix ineed</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):276
msgid "Similarly, you can ask what services require the service (<c>needsme</c>) or can use it (<c>usesme</c>):"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):281
msgid "Requesting a list of all services that require Postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):281
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix needsme</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):285
msgid "Finally, you can ask what dependencies the service requires that are missing:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):289
msgid "Requesting a list of missing dependencies for Postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):289
#, no-wrap
msgid "\n# <i>/etc/init.d/postfix broken</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):297
msgid "Working with rc-update"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):299
msgid "What is rc-update?"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):302
msgid "Gentoo's init system uses a dependency-tree to decide what service needs to be started first. As this is a tedious task that we wouldn't want our users to have to do manually, we have created tools that ease the administration of the runlevels and init scripts."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):309
msgid "With <c>rc-update</c> you can add and remove init scripts to a runlevel. The <c>rc-update</c> tool will then automatically ask the <c>depscan.sh</c> script to rebuild the dependency tree."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):318
msgid "Adding and Removing Services"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):321
msgid "You have already added init scripts to the \"default\" runlevel during the installation of Gentoo. At that time you might not have had a clue what the \"default\" is for, but now you should. The <c>rc-update</c> script requires a second argument that defines the action: <e>add</e>, <e>del</e> or <e>show</e>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):328
msgid "To add or remove an init script, just give <c>rc-update</c> the <c>add</c> or <c>del</c> argument, followed by the init script and the runlevel. For instance:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):333
msgid "Removing Postfix from the default runlevel"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):333
#, no-wrap
msgid "\n# <i>rc-update del postfix default</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):337
msgid "The <c>rc-update -v show</c> command will show all the available init scripts and list at which runlevels they will execute:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):342
msgid "Receiving init script information"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):342
#, no-wrap
msgid "\n# <i>rc-update -v show</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):346
msgid "You can also run <c>rc-update show</c> (without <c>-v</c>) to just view enabled init scripts and their runlevels."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):355
msgid "Configuring Services"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):357
msgid "Why the Need for Extra Configuration?"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):360
msgid "Init scripts can be quite complex. It is therefore not really desirable to have the users edit the init script directly, as it would make it more error-prone. It is however important to be able to configure such a service. For instance, you might want to give more options to the service itself."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):367
msgid "A second reason to have this configuration outside the init script is to be able to update the init scripts without the fear that your configuration changes will be undone."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):376
msgid "The /etc/conf.d Directory"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):379
msgid "Gentoo provides an easy way to configure such a service: every init script that can be configured has a file in <path>/etc/conf.d</path>. For instance, the apache2 initscript (called <path>/etc/init.d/apache2</path>) has a configuration file called <path>/etc/conf.d/apache2</path>, which can contain the options you want to give to the Apache 2 server when it is started:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):387
msgid "Variable defined in /etc/conf.d/apache2"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):387
#, no-wrap
msgid "\nAPACHE2_OPTS=\"-D PHP5\"\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):391
msgid "Such a configuration file contains variables and variables alone (just like <path>/etc/make.conf</path>), making it very easy to configure services. It also allows us to provide more information about the variables (as comments)."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):401
msgid "Writing Init Scripts"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):403
msgid "Do I Have To?"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):406
msgid "No, writing an init script is usually not necessary as Gentoo provides ready-to-use init scripts for all provided services. However, you might have installed a service without using Portage, in which case you will most likely have to create an init script."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):413
msgid "Do not use the init script provided by the service if it isn't explicitly written for Gentoo: Gentoo's init scripts are not compatible with the init scripts used by other distributions!"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):422
msgid "Layout"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):425
msgid "The basic layout of an init script is shown below."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):429
msgid "Basic layout of an init script"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):429
#, no-wrap
msgid "\n#!/sbin/runscript\n\ndepend() {\n <comment>(Dependency information)</comment>\n}\n\nstart() {\n <comment>(Commands necessary to start the service)</comment>\n}\n\nstop() {\n <comment>(Commands necessary to stop the service)</comment>\n}\n\nrestart() {\n <comment>(Commands necessary to restart the service)</comment>\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):449
msgid "Any init script <e>requires</e> the <c>start()</c> function to be defined. All other sections are optional."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):457
msgid "Dependencies"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):460
msgid "There are two dependencies you can define: <c>use</c> and <c>need</c>. As we have mentioned before, the <c>need</c> dependency is more strict than the <c>use</c> dependency. Following this dependency type you enter the service you depend on, or the <e>virtual</e> dependency."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):467
msgid "A <e>virtual</e> dependency is a dependency that a service provides, but that is not provided solely by that service. Your init script can depend on a system logger, but there are many system loggers available (metalogd, syslog-ng, sysklogd, ...). As you cannot <c>need</c> every single one of them (no sensible system has all these system loggers installed and running) we made sure that all these services <c>provide</c> a virtual dependency."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):476
msgid "Let us take a look at the dependency information for the postfix service."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):480
msgid "Dependency information for Postfix"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):480
#, no-wrap
msgid "\ndepend() {\n need net\n use logger dns\n provide mta\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):488
msgid "As you can see, the postfix service:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(li):493
msgid "requires the (virtual) <c>net</c> dependency (which is provided by, for instance, <path>/etc/init.d/net.eth0</path>)"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(li):497
msgid "uses the (virtual) <c>logger</c> dependency (which is provided by, for instance, <path>/etc/init.d/syslog-ng</path>)"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(li):501
msgid "uses the (virtual) <c>dns</c> dependency (which is provided by, for instance, <path>/etc/init.d/named</path>)"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(li):505
msgid "provides the (virtual) <c>mta</c> dependency (which is common for all mail servers)"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):514
msgid "Controlling the Order"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):517
msgid "In some cases you might not require a service, but want your service to be started <c>before</c> (or <c>after</c>) another service <e>if</e> it is available on the system (note the conditional - this is no dependency anymore) <e>and</e> run in the same runlevel (note the conditional - only services in the same runlevel are involved). You can provide this information using the <c>before</c> or <c>after</c> settings."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):526
msgid "As an example we view the settings of the Portmap service:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):530
msgid "The depend() function in the Portmap service"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):530
#, no-wrap
msgid "\ndepend() {\n need net\n before inetd\n before xinetd\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):538
msgid "You can also use the \"*\" glob to catch all services in the same runlevel, although this isn't advisable."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):543
msgid "Running an init script as first script in the runlevel"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):543
#, no-wrap
msgid "\ndepend() {\n before *\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):549
msgid "If your service must write to local disks, it should need <c>localmount</c>. If it places anything in <path>/var/run</path> such as a pidfile, then it should start after <c>bootmisc</c>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):555
msgid "Example depend() function"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):555
#, no-wrap
msgid "\ndepend() {\n need localmount\n after bootmisc\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):565
msgid "Standard Functions"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):568
msgid "Next to the <c>depend()</c> functionality, you also need to define the <c>start()</c> function. This one contains all the commands necessary to initialize your service. It is advisable to use the <c>ebegin</c> and <c>eend</c> functions to inform the user about what is happening:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):575
msgid "Example start() function"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):575
#, no-wrap
msgid "\nstart() {\n ebegin \"Starting my_service\"\n start-stop-daemon --start --exec /path/to/my_service \\\n --pidfile /path/to/my_pidfile\n eend $?\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):584
msgid "Both <c>--exec</c> and <c>--pidfile</c> should be used in start and stop functions. If the service does not create a pidfile, then use <c>--make-pidfile</c> if possible, though you should test this to be sure. Otherwise, don't use pidfiles. You can also add <c>--quiet</c> to the <c>start-stop-daemon</c> options, but this is not recommended unless the service is extremely verbose. Using <c>--quiet</c> may hinder debugging if the service fails to start."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(note):594
msgid "Make sure that <c>--exec</c> actually calls a service and not just a shell script that launches services and exits -- that's what the init script is supposed to do."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):600
msgid "If you need more examples of the <c>start()</c> function, please read the source code of the available init scripts in your <path>/etc/init.d</path> directory."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):606
msgid "Other functions you can define are: <c>stop()</c> and <c>restart()</c>. You are not obliged to define these functions! Our init system is intelligent enough to fill these functions by itself if you use <c>start-stop-daemon</c>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):612
msgid "Although you do not <e>have</e> to create a <c>stop()</c> function, here is an example:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):617
msgid "Example stop() function"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):617
#, no-wrap
msgid "\nstop() {\n ebegin \"Stopping my_service\"\n start-stop-daemon --stop --exec /path/to/my_service \\\n --pidfile /path/to/my_pidfile\n eend $?\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):626
msgid "If your service runs some other script (for example, bash, python, or perl), and this script later changes names (for example, <c>foo.py</c> to <c>foo</c>), then you will need to add <c>--name</c> to <c>start-stop-daemon</c>. You must specify the name that your script will be changed to. In this example, a service starts <c>foo.py</c>, which changes names to <c>foo</c>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):634
msgid "A service that starts the foo script"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):634
#, no-wrap
msgid "\nstart() {\n ebegin \"Starting my_script\"\n start-stop-daemon --start --exec /path/to/my_script \\\n --pidfile /path/to/my_pidfile --name foo\n eend $?\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):643
msgid "<c>start-stop-daemon</c> has an excellent man page available if you need more information:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):648
msgid "Getting the man page for start-stop-daemon"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):648
#, no-wrap
msgid "\n$ <i>man start-stop-daemon</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):652
msgid "Gentoo's init script syntax is based on the Bourne Again Shell (bash) so you are free to use bash-compatible constructs inside your init script."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):660
msgid "Adding Custom Options"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):663
msgid "If you want your init script to support more options than the ones we have already encountered, you should add the option to the <c>opts</c> variable, and create a function with the same name as the option. For instance, to support an option called <c>restartdelay</c>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):670
msgid "Supporting the restartdelay option"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):670
#, no-wrap
msgid "\nopts=\"${opts} restartdelay\"\n\nrestartdelay() {\n stop\n sleep 3 <comment># Wait 3 seconds before starting again</comment>\n start\n}\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):683
msgid "Service Configuration Variables"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):686
msgid "You don't have to do anything to support a configuration file in <path>/etc/conf.d</path>: if your init script is executed, the following files are automatically sourced (i.e. the variables are available to use):"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):698
msgid "Also, if your init script provides a virtual dependency (such as <c>net</c>), the file associated with that dependency (such as <path>/etc/conf.d/net</path>) will be sourced too."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):708
msgid "Changing the Runlevel Behaviour"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):710
msgid "Who might benefit from this?"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):713
msgid "Many laptop users know the situation: at home you need to start <c>net.eth0</c> while you don't want to start <c>net.eth0</c> while you're on the road (as there is no network available). With Gentoo you can alter the runlevel behaviour to your own will."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):720
msgid "For instance you can create a second \"default\" runlevel which you can boot that has other init scripts assigned to it. You can then select at boottime what default runlevel you want to use."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):729
msgid "Using softlevel"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):732
msgid "First of all, create the runlevel directory for your second \"default\" runlevel. As an example we create the <path>offline</path> runlevel:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):737
msgid "Creating a runlevel directory"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):737
#, no-wrap
msgid "\n# <i>mkdir /etc/runlevels/offline</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):741
msgid "Add the necessary init scripts to the newly created runlevels. For instance, if you want to have an exact copy of your current <c>default</c> runlevel but without <c>net.eth0</c>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):747
msgid "Adding the necessary init scripts"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):747
#, no-wrap
msgid "\n<comment>(Copy all services from default runlevel to offline runlevel)</comment>\n# <i>cd /etc/runlevels/default</i>\n# <i>for service in *; do rc-update add $service offline; done</i>\n<comment>(Remove unwanted service from offline runlevel)</comment>\n# <i>rc-update del net.eth0 offline</i>\n<comment>(Display active services for offline runlevel)</comment>\n# <i>rc-update show offline</i>\n<comment>(Partial sample Output)</comment>\n acpid | offline\n domainname | offline\n local | offline\n net.eth0 |\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):762
msgid "Even though <c>net.eth0</c> has been removed from the offline runlevel, <c>udev</c> will still attempt to start any devices it detects and launch the appropriate services. Therefore, you will need to add each network service you do not want started (as well as services for any other devices that may be started by udev) to <path>/etc/conf.d/rc</path> as shown."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):770
msgid "Disabling device initiated services in /etc/conf.d/rc"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):770
#, no-wrap
msgid "\nRC_COLDPLUG=\"yes\"\n<comment>(Next, specify the services you do not want automatically started)</comment>\nRC_PLUG_SERVICES=\"!net.eth0\"\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(note):776
msgid "For more information on device initiated services, please see the comments inside <path>/etc/conf.d/rc</path>."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):781
msgid "Now edit your bootloader configuration and add a new entry for the <c>offline</c> runlevel. For instance, in <path>/boot/grub/grub.conf</path>:"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre:caption):786
msgid "Adding an entry for the offline runlevel"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(pre):786
#, no-wrap
msgid "\ntitle Gentoo Linux Offline Usage\n root (hd0,0)\n kernel (hd0,0)/kernel-2.4.25 root=/dev/hda3 <i>softlevel=offline</i>\n"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):792
msgid "Voilà, you're all set now. If you boot your system and select the newly added entry at boot, the <c>offline</c> runlevel will be used instead of the <c>default</c> one."
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(title):801
msgid "Using bootlevel"
msgstr ""
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(p):804
msgid "Using <c>bootlevel</c> is completely analogous to <c>softlevel</c>. The only difference here is that you define a second \"boot\" runlevel instead of a second \"default\" runlevel."
msgstr ""
#. Place here names of translator, one per line. Format should be NAME; ROLE; E-MAIL
#: ../../gentoo/xml/htdocs/doc/en/handbook//hb-working-rcscripts.xml(None):0
msgid "translator-credits"
msgstr ""
|