OSDN Git Service

38235f749dd2573f834c69037534a60b6652a1b3
[linuxjf/JF.git] / docs / LFS-BOOK / scripts / apds04.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4   <head>
5     <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
6     <title>
7       D.4. /etc/rc.d/init.d/consolelog
8     </title>
9     <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
10     <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
11     <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
12     "text/css" media="print" />
13   </head>
14   <body class="lfs" id="lfs-6.8">
15     <div class="navheader">
16       <h4>
17         Linux From Scratch - Version 6.8
18       </h4>
19       <h3>
20         付録 D. ブートスクリプトと sysconfig スクリプト version-20100627
21       </h3>
22       <ul>
23         <li class="prev">
24           <a accesskey="p" href="apds03.html" title=
25           "/etc/rc.d/init.d/mountkernfs">前のページ</a>
26           <p>
27             /etc/rc.d/init.d/mountkernfs
28           </p>
29         </li>
30         <li class="next">
31           <a accesskey="n" href="apds05.html" title=
32           "/etc/rc.d/init.d/modules">次のページ</a>
33           <p>
34             /etc/rc.d/init.d/modules
35           </p>
36         </li>
37         <li class="up">
38           <a accesskey="u" href="scripts.html" title=
39           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
40         </li>
41         <li class="home">
42           <a accesskey="h" href="../index.html" title=
43           "Linux From Scratch - Version 6.8">ホーム</a>
44         </li>
45       </ul>
46     </div>
47     <div class="wrap" lang="ja" xml:lang="ja">
48       <h1 class="sect1">
49         <a id="consolelog" name="consolelog"></a>D.4.
50         /etc/rc.d/init.d/consolelog
51       </h1>
52       <pre class="screen">
53 #!/bin/sh
54 # Begin $rc_base/init.d/consolelog
55
56 ########################################################################
57 #
58 # Description : Set the kernel log level for the console
59 #
60 # Authors     : Dan Nicholson - dnicholson@linuxfromscratch.org
61 #
62 # Version     : 00.00
63 #
64 # Notes       : /proc must be mounted before this can run
65 #
66 ########################################################################
67
68 . /etc/sysconfig/rc
69 . ${rc_functions}
70
71 # set the default loglevel
72 LOGLEVEL=7
73 if [ -r /etc/sysconfig/console ]; then
74     . /etc/sysconfig/console
75 fi
76
77 case "${1}" in
78     start)
79         case "$LOGLEVEL" in
80         [1-8])
81             boot_mesg "Setting the console log level to ${LOGLEVEL}..."
82             dmesg -n $LOGLEVEL
83             evaluate_retval
84             ;;
85         *)
86             boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
87             echo_failure
88             ;;
89         esac
90         ;;
91     status)
92         # Read the current value if possible
93         if [ -r /proc/sys/kernel/printk ]; then
94             read level line &lt; /proc/sys/kernel/printk
95         else
96             boot_mesg "Can't read the current console log level" ${FAILURE}
97             echo_failure
98         fi
99
100         # Print the value
101         if [ -n "$level" ]; then
102             ${ECHO} -e "${INFO}The current console log level" \
103                 "is ${level}${NORMAL}"
104         fi
105         ;;
106
107     *)
108         echo "Usage: ${0} {start|status}"
109         exit 1
110         ;;
111 esac
112
113 # End $rc_base/init.d/consolelog
114 </pre>
115     </div>
116     <div class="navfooter">
117       <ul>
118         <li class="prev">
119           <a accesskey="p" href="apds03.html" title=
120           "/etc/rc.d/init.d/mountkernfs">前のページ</a>
121           <p>
122             /etc/rc.d/init.d/mountkernfs
123           </p>
124         </li>
125         <li class="next">
126           <a accesskey="n" href="apds05.html" title=
127           "/etc/rc.d/init.d/modules">次のページ</a>
128           <p>
129             /etc/rc.d/init.d/modules
130           </p>
131         </li>
132         <li class="up">
133           <a accesskey="u" href="scripts.html" title=
134           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
135         </li>
136         <li class="home">
137           <a accesskey="h" href="../index.html" title=
138           "Linux From Scratch - Version 6.8">ホーム</a>
139         </li>
140       </ul>
141     </div>
142   </body>
143 </html>