softflowd.init 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. #
  3. # softflowd Starts softflowd NetFlow probe
  4. # $Id$
  5. #
  6. # chkconfig: 2345 95 02
  7. # description: Starts and stops the softflowd Netflow probe
  8. # Source function library.
  9. . /etc/init.d/functions
  10. SOFTFLOW_CONF=/etc/sysconfig/softflowd
  11. SOFTFLOW_LOCK=/var/lock/subsys/softflowd
  12. SOFTFLOW_PROG=/usr/sbin/softflowd
  13. SOFTFLOW_OPTS="-i eth0"
  14. # Source config
  15. if [ -f $SOFTFLOW_CONF ]; then
  16. . $SOFTFLOW_CONF
  17. fi
  18. [ -x $SOFTFLOW_PROG ] || exit 0
  19. RETVAL=0
  20. start() {
  21. echo -n $"Starting softflowd: "
  22. daemon $SOFTFLOW_PROG $SOFTFLOW_OPTS
  23. RETVAL=$?
  24. echo
  25. [ $RETVAL -eq 0 ] && touch $SOFTFLOW_LOCK
  26. return $RETVAL
  27. }
  28. stop() {
  29. echo -n $"Shutting down softflowd: "
  30. killproc $SOFTFLOW_PROG
  31. RETVAL=$?
  32. echo
  33. [ $RETVAL -eq 0 ] && rm -f $SOFTFLOW_LOCK
  34. return $RETVAL
  35. }
  36. restart() {
  37. stop
  38. start
  39. }
  40. case "$1" in
  41. start)
  42. start
  43. ;;
  44. stop)
  45. stop
  46. ;;
  47. status)
  48. status $SOFTFLOW_PROG
  49. ;;
  50. restart|reload)
  51. restart
  52. ;;
  53. condrestart)
  54. [ -f $SOFTFLOW_LOCK ] && restart || :
  55. ;;
  56. *)
  57. echo $"Usage: $0 {start|stop|status|restart|condrestart}"
  58. exit 1
  59. esac
  60. exit $?