S29netplug 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. # Source function library.
  13. if [ -f /etc/init.d/functions ]; then
  14. . /etc/init.d/functions
  15. elif [ -f /etc/rc.d/init.d/functions ]; then
  16. . /etc/rc.d/init.d/functions
  17. fi
  18. # Source networking configuration.
  19. if [ -f /etc/sysconfig/network ]; then
  20. . /etc/sysconfig/network
  21. # Check that networking is up.
  22. [ ${NETWORKING} = "no" ] && exit 0
  23. elif [ ! -f /etc/network/interfaces ]; then
  24. # No network support
  25. exit 0
  26. fi
  27. [ -x /sbin/netplugd ] || exit 0
  28. if [ -f /etc/sysconfig/netplugd ]; then
  29. . /etc/sysconfig/netplugd
  30. fi
  31. # See how we were called.
  32. case "$1" in
  33. start)
  34. # Start daemon.
  35. echo -n $"Starting network plug daemon: "
  36. start-stop-daemon -S -q -p /var/run/netplugd.pid -x /sbin/netplugd ${NETPLUGDARGS}
  37. RETVAL=$?
  38. echo
  39. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd
  40. ;;
  41. stop)
  42. # Stop daemon.
  43. echo -n $"Shutting down network plug daemon: "
  44. start-stop-daemon -K -n netplugd
  45. RETVAL=$?
  46. echo
  47. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd
  48. ;;
  49. restart|reload)
  50. $0 stop
  51. $0 start
  52. ;;
  53. condrestart)
  54. [ -f /var/lock/subsys/netplugd ] && $0 restart || :
  55. ;;
  56. *)
  57. echo $"Usage: $0 {start|stop|restart}"
  58. RETVAL=1
  59. ;;
  60. esac
  61. exit $RETVAL