| … | |
… | |
| 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/2.5 --> |
5 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 6 | |
6 | |
| 7 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.35 2011/08/17 07:57:23 swift Exp $ --> |
7 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.36 2011/09/17 12:45:11 swift Exp $ --> |
| 8 | |
8 | |
| 9 | <sections> |
9 | <sections> |
| 10 | |
10 | |
| 11 | <abstract> |
11 | <abstract> |
| 12 | Gentoo uses a special initscript format which, amongst other features, allows |
12 | Gentoo uses a special initscript format which, amongst other features, allows |
| 13 | dependency-driven decisions and virtual initscripts. This chapter explains all |
13 | dependency-driven decisions and virtual initscripts. This chapter explains all |
| 14 | these aspects and explains how to deal with these scripts. |
14 | these aspects and explains how to deal with these scripts. |
| 15 | </abstract> |
15 | </abstract> |
| 16 | |
16 | |
| 17 | <version>4</version> |
17 | <version>5</version> |
| 18 | <date>2011-08-17</date> |
18 | <date>2011-09-17</date> |
| 19 | |
19 | |
| 20 | <section> |
20 | <section> |
| 21 | <title>Runlevels</title> |
21 | <title>Runlevels</title> |
| 22 | <subsection> |
22 | <subsection> |
| 23 | <title>Booting your System</title> |
23 | <title>Booting your System</title> |
| … | |
… | |
| 717 | <title>Adding Custom Options</title> |
717 | <title>Adding Custom Options</title> |
| 718 | <body> |
718 | <body> |
| 719 | |
719 | |
| 720 | <p> |
720 | <p> |
| 721 | If you want your init script to support more options than the ones we have |
721 | If you want your init script to support more options than the ones we have |
| 722 | already encountered, you should add the option to the <c>opts</c> variable, and |
722 | already encountered, you should add the option to the <c>extra_commands</c> |
| 723 | create a function with the same name as the option. For instance, to support an |
723 | variable, and create a function with the same name as the option. For instance, |
| 724 | option called <c>restartdelay</c>: |
724 | to support an option called <c>restartdelay</c>: |
| 725 | </p> |
725 | </p> |
| 726 | |
726 | |
| 727 | <pre caption="Supporting the restartdelay option"> |
727 | <pre caption="Supporting the restartdelay option"> |
| 728 | opts="${opts} restartdelay" |
728 | extra_commands="restartdelay" |
| 729 | |
729 | |
| 730 | restartdelay() { |
730 | restartdelay() { |
| 731 | stop |
731 | stop |
| 732 | sleep 3 <comment># Wait 3 seconds before starting again</comment> |
732 | sleep 3 <comment># Wait 3 seconds before starting again</comment> |
| 733 | start |
733 | start |