network 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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-Provided-By: LFS
  14. ### END INIT INFO
  15. . /lib/lsb/init-functions
  16. . /etc/sysconfig/network
  17. case "${1}" in
  18. start)
  19. # Start all network interfaces
  20. for file in ${NETWORK_DEVICES}/ifconfig.*
  21. do
  22. interface=${file##*/ifconfig.}
  23. # skip if $file is * (because nothing was found)
  24. if [ "${interface}" = "*" ]
  25. then
  26. continue
  27. fi
  28. IN_BOOT=1 ${NETWORK_DEVICES}/ifup ${interface}
  29. done
  30. ;;
  31. stop)
  32. # Reverse list
  33. FILES=""
  34. for file in ${NETWORK_DEVICES}/ifconfig.*
  35. do
  36. FILES="${file} ${FILES}"
  37. done
  38. # Stop all network interfaces
  39. for file in ${FILES}
  40. do
  41. interface=${file##*/ifconfig.}
  42. # skip if $file is * (because nothing was found)
  43. if [ "${interface}" = "*" ]
  44. then
  45. continue
  46. fi
  47. IN_BOOT=1 ${NETWORK_DEVICES}/ifdown ${interface}
  48. done
  49. ;;
  50. restart)
  51. ${0} stop
  52. sleep 1
  53. ${0} start
  54. ;;
  55. *)
  56. echo "Usage: ${0} {start|stop|restart}"
  57. exit 1
  58. ;;
  59. esac
  60. # End /etc/init.d/network