softflowd.init 1.1 KB

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