localnet.xml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. <para>
  8. <screen>
  9. <userinput>cat &gt; /etc/init.d/localnet &lt;&lt; "EOF"</userinput>
  10. #!/bin/sh
  11. # Begin /etc/init.d/localnet
  12. #
  13. # Include the functions declared in the /etc/init.d/functions file
  14. # and include the variables from the /etc/sysconfig/network file.
  15. #
  16. source /etc/init.d/functions
  17. source /etc/sysconfig/network
  18. case "$1" in
  19. start)
  20. echo -n "Bringing up the loopback interface..."
  21. /sbin/ifconfig lo 127.0.0.1
  22. evaluate_retval
  23. echo -n "Setting up hostname..."
  24. /bin/hostname $HOSTNAME
  25. evaluate_retval
  26. ;;
  27. stop)
  28. echo -n "Bringing down the loopback interface..."
  29. /sbin/ifconfig lo down
  30. evaluate_retval
  31. ;;
  32. restart)
  33. $0 stop
  34. sleep 1
  35. $0 start
  36. ;;
  37. *)
  38. echo "Usage: $0: {start|stop|restart}"
  39. exit 1
  40. ;;
  41. esac
  42. # End /etc/init.d/localnet
  43. <userinput>EOF</userinput>
  44. </screen>
  45. </para>
  46. </sect1>