📄 localnet.html
字号:
<HTML><HEAD><TITLE>Creating the localnet script</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.63"><LINKREL="HOME"TITLE="Linux From Scratch"HREF="../index.html"><LINKREL="UP"TITLE="Creating system boot scripts"HREF="../chapter07/chapter07.html"><LINKREL="PREVIOUS"TITLE="Creating the template script"HREF="../chapter07/template.html"><LINKREL="NEXT"TITLE="Creating the /etc/sysconfig/network file"HREF="../chapter07/network.html"></HEAD><BODYCLASS="sect1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Linux From Scratch: Version 3.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="../chapter07/template.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 7. Creating system boot scripts</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="../chapter07/network.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch07-localnet">7.16. Creating the localnet script</A></H1><P>Create the <TTCLASS="filename">/etc/init.d/localnet</TT> script by runningthe following command:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>cat > /etc/init.d/localnet << "EOF"</B></TT>#!/bin/sh # Begin /etc/init.d/localnet## Include the functions declared in the /etc/init.d/functions file# and include the variables from the /etc/sysconfig/network file.# source /etc/init.d/functionssource /etc/sysconfig/networkcase "$1" in start) echo -n "Bringing up the loopback interface..." /sbin/ifconfig lo 127.0.0.1 evaluate_retval echo -n "Setting up hostname..." /bin/hostname $HOSTNAME evaluate_retval ;; stop) echo -n "Bringing down the loopback interface..." /sbin/ifconfig lo down evaluate_retval ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0: {start|stop|restart}" exit 1 ;;esac# End /etc/init.d/localnet<TTCLASS="userinput"><B>EOF</B></TT></PRE></FONT></TD></TR></TABLE></P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="../chapter07/template.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter07/network.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Creating the template script</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter07/chapter07.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Creating the /etc/sysconfig/network file</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -