localnet.xml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <sect1 id="ch07-localnet">
  2. <title>Creating the /etc/init.d/localnet boot script</title>
  3. <para>
  4. A new file <filename>/etc/init.d/localnet</filename> is created containing
  5. the following:
  6. </para>
  7. <literallayout>
  8. <userinput>cat &gt; /etc/init.d/localnet &lt;&lt; "EOF"</userinput>
  9. #!/bin/sh
  10. # Begin /etc/init.d/localnet
  11. #
  12. # Include the functions declared in the /etc/init.d/functions file
  13. # and include the variables from the /etc/sysconfig/network file.
  14. #
  15. source /etc/init.d/functions
  16. source /etc/sysconfig/network
  17. case "$1" in
  18. start)
  19. echo -n "Bringing up the loopback interface..."
  20. /sbin/ifconfig lo 127.0.0.1
  21. evaluate_retval
  22. echo -n "Setting up hostname..."
  23. /bin/hostname $HOSTNAME
  24. evaluate_retval
  25. ;;
  26. stop)
  27. echo -n "Bringing down the loopback interface..."
  28. /sbin/ifconfig lo down
  29. evaluate_retval
  30. ;;
  31. restart)
  32. $0 stop
  33. sleep 1
  34. $0 start
  35. ;;
  36. *)
  37. echo "Usage: $0: {start|stop|restart}"
  38. exit 1
  39. ;;
  40. esac
  41. # End /etc/init.d/localnet
  42. <userinput>EOF</userinput>
  43. </literallayout>
  44. </sect1>