network 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin $rc_base/init.d/network
  4. #
  5. # Description : Network Control Script
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. # Nathan Coulson - nathan@linuxfromscratch.org
  9. # Kevin P. Fleming - kpfleming@linuxfromscratch.org
  10. #
  11. # Version : 00.00
  12. #
  13. # Notes :
  14. #
  15. ########################################################################
  16. . /etc/sysconfig/rc
  17. . ${rc_functions}
  18. . /etc/sysconfig/network
  19. case "${1}" in
  20. start)
  21. # Start all network interfaces
  22. for file in ${network_devices}/ifconfig.*
  23. do
  24. interface=${file##*/ifconfig.}
  25. # skip if $file is * (because nothing was found)
  26. if [ "${interface}" = "*" ]
  27. then
  28. continue
  29. fi
  30. IN_BOOT=1 ${network_devices}/ifup ${interface}
  31. done
  32. ;;
  33. stop)
  34. # Reverse list
  35. FILES=""
  36. for file in ${network_devices}/ifconfig.*
  37. do
  38. FILES="${file} ${FILES}"
  39. done
  40. # Stop all network interfaces
  41. for file in ${FILES}
  42. do
  43. interface=${file##*/ifconfig.}
  44. # skip if $file is * (because nothing was found)
  45. if [ "${interface}" = "*" ]
  46. then
  47. continue
  48. fi
  49. IN_BOOT=1 ${network_devices}/ifdown ${interface}
  50. done
  51. ;;
  52. restart)
  53. ${0} stop
  54. sleep 1
  55. ${0} start
  56. ;;
  57. *)
  58. echo "Usage: ${0} {start|stop|restart}"
  59. exit 1
  60. ;;
  61. esac
  62. # End /etc/rc.d/init.d/network