network 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # Begin /etc/init.d/network
  3. ### BEGIN INIT INFO
  4. # Provides: $network
  5. # Required-Start: $local_fs swap localnet
  6. # Should-Start: $syslog
  7. # Required-Stop: $local_fs swap localnet
  8. # Should-Stop: $syslog
  9. # Default-Start: 3 4 5
  10. # Default-Stop: 0 1 2 6
  11. # Short-Description: Starts and configures network interfaces.
  12. # Description: Starts and configures network interfaces.
  13. # X-LFS-Default-Start: S20
  14. # X-LFS-Default-Stop: K80
  15. # X-LFS-Provided-By: LFS
  16. ### END INIT INFO
  17. . /lib/lsb/init-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/init.d/network