S29netplug 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. #
  3. # netplugd This shell script takes care of starting and stopping
  4. # the network plug management daemon.
  5. #
  6. # chkconfig: - 11 89
  7. # description: netplugd is a daemon for managing non-static network \
  8. # interfaces.
  9. # processname: netplugd
  10. # pidfile: /var/run/netplugd.pid
  11. # Copyright 2003 Key Research, Inc.
  12. # Create needed directories
  13. mkdir -p /var/lock/subsys
  14. # Source function library.
  15. if [ -f /etc/init.d/functions ]; then
  16. . /etc/init.d/functions
  17. elif [ -f /etc/rc.d/init.d/functions ]; then
  18. . /etc/rc.d/init.d/functions
  19. fi
  20. # Source networking configuration.
  21. if [ -f /etc/default/network ]; then
  22. . /etc/default/network
  23. # Check that networking is up.
  24. [ "${NETWORKING}" = "no" ] && exit 0
  25. elif [ ! -f /etc/network/interfaces ]; then
  26. # No network support
  27. exit 0
  28. fi
  29. if [ -f /etc/default/netplugd ]; then
  30. . /etc/default/netplugd
  31. fi
  32. # See how we were called.
  33. case "$1" in
  34. start)
  35. # Start daemon.
  36. printf "Starting network plug daemon: "
  37. start-stop-daemon -S -q -x /sbin/netplugd -- -p /var/run/netplugd.pid ${NETPLUGDARGS}
  38. RETVAL=$?
  39. echo
  40. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
  41. ;;
  42. stop)
  43. # Stop daemon.
  44. printf "Shutting down network plug daemon: "
  45. start-stop-daemon -K -q -p /var/run/netplugd.pid
  46. RETVAL=$?
  47. echo
  48. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
  49. ;;
  50. restart|reload)
  51. $0 stop
  52. $0 start
  53. ;;
  54. condrestart)
  55. [ -f /var/lock/subsys/netplugd ] && $0 restart || :
  56. ;;
  57. *)
  58. echo "Usage: $0 {start|stop|restart}"
  59. RETVAL=1
  60. ;;
  61. esac
  62. exit $RETVAL