/[gentoo]/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml
Gentoo

Diff of /xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.20 Revision 1.22
2<!DOCTYPE sections SYSTEM "/dtd/book.dtd"> 2<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3 3
4<!-- The content of this document is licensed under the CC-BY-SA license --> 4<!-- The content of this document is licensed under the CC-BY-SA license -->
5<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 5<!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
6 6
7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.20 2004/11/20 22:23:30 neysx Exp $ --> 7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.22 2005/05/19 23:10:20 neysx Exp $ -->
8 8
9<sections> 9<sections>
10 10
11<version>1.17</version> 11<version>1.19</version>
12<date>2004-10-23</date> 12<date>2005-05-20</date>
13 13
14<section> 14<section>
15<title>Runlevels</title> 15<title>Runlevels</title>
16<subsection> 16<subsection>
17<title>Booting your System</title> 17<title>Booting your System</title>
571Other functions you can define are: <c>stop()</c> and <c>restart()</c>. You are 571Other functions you can define are: <c>stop()</c> and <c>restart()</c>. You are
572not obliged to define these functions! Our init system is intelligent enough to 572not obliged to define these functions! Our init system is intelligent enough to
573fill these functions by itself if you use <c>start-stop-daemon</c>. 573fill these functions by itself if you use <c>start-stop-daemon</c>.
574</p> 574</p>
575 575
576<p>
577Gentoo's init script syntax is based on the Bourne Again Shell (bash) so you are
578free to use bash-compatible constructs inside your init script.
579</p>
580
576</body> 581</body>
577</subsection> 582</subsection>
578<subsection> 583<subsection>
579<title>Adding Custom Options</title> 584<title>Adding Custom Options</title>
580<body> 585<body>
643</p> 648</p>
644 649
645</body> 650</body>
646</subsection> 651</subsection>
647<subsection> 652<subsection>
648<title>Using SOFTLEVEL</title> 653<title>Using softlevel</title>
649<body> 654<body>
650 655
651<p> 656<p>
652First of all, create the runlevel directory for your second "default" runlevel. 657First of all, create the runlevel directory for your second "default" runlevel.
653As an example we create the <path>offline</path> runlevel: 658As an example we create the <path>offline</path> runlevel:
662you want to have an exact copy of your current <c>default</c> runlevel but 667you want to have an exact copy of your current <c>default</c> runlevel but
663without <c>net.eth0</c>: 668without <c>net.eth0</c>:
664</p> 669</p>
665 670
666<pre caption="Adding the necessary init scripts"> 671<pre caption="Adding the necessary init scripts">
667# <i>ls /etc/runlevels/default</i> 672<comment>(Copy all services from default runlevel to offline runlevel)</comment>
668acpid domainname local net.eth0 netmount postfix syslog-ng vixie-cron 673# <i>for service in /etc/runlevels/default/*; do rc-update add $service offline; done</i>
669# <i>rc-update add acpid offline</i> 674<comment>(Remove unwanted service from offline runlevel)</comment>
670# <i>rc-update add domainname offline</i> 675# <i>rc-update del net.eth0 offline</i>
676<comment>(Display active services for offline runlevel)</comment>
671# <i>rc-update add local offline</i> 677# <i>rc-update show offline</i>
672# <i>rc-update add syslog-ng offline</i> 678<comment>(Partial sample Output)</comment>
673# <i>rc-update add vixie-cron offline</i> 679 acpid | offline
680 domainname | offline
681 local | offline
682 net.eth0 |
674</pre> 683</pre>
675 684
676<p> 685<p>
677Now edit your bootloader configuration and add a new entry for the 686Now edit your bootloader configuration and add a new entry for the
678<c>offline</c> runlevel. For instance, in <path>/boot/grub/grub.conf</path>: 687<c>offline</c> runlevel. For instance, in <path>/boot/grub/grub.conf</path>:
683 root (hd0,0) 692 root (hd0,0)
684 kernel (hd0,0)/kernel-2.4.25 root=/dev/hda3 <i>softlevel=offline</i> 693 kernel (hd0,0)/kernel-2.4.25 root=/dev/hda3 <i>softlevel=offline</i>
685</pre> 694</pre>
686 695
687<p> 696<p>
688Voila, you're all set now. If you boot your system and select the newly added 697Voilà, you're all set now. If you boot your system and select the newly added
689entry at boot, the <c>offline</c> runlevel will be used instead of the 698entry at boot, the <c>offline</c> runlevel will be used instead of the
690<c>default</c> one. 699<c>default</c> one.
691</p> 700</p>
692 701
693</body> 702</body>
694</subsection> 703</subsection>
695<subsection> 704<subsection>
696<title>Using BOOTLEVEL</title> 705<title>Using bootlevel</title>
697<body> 706<body>
698 707
699<p> 708<p>
700Using <c>bootlevel</c> is completely analogous to <c>softlevel</c>. The only 709Using <c>bootlevel</c> is completely analogous to <c>softlevel</c>. The only
701difference here is that you define a second "boot" runlevel instead of a second 710difference here is that you define a second "boot" runlevel instead of a second

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20