summaryrefslogtreecommitdiff
path: root/init.d/local-flowscan
blob: 171e20f675b924783e6e89162cd37328b6eaa188 (plain)
  1. #!/bin/sh -e
  2. #
  3. # flowscan Transforms Cisco netflow files into rrd files.
  4. #
  5. # chkconfig: 345 20 20
  6. #
  7. # description: Start / stop the netflow recorder
  8. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  9. DAEMON=/usr/bin/flowscan
  10. CONFIG=/etc/flowscan/flowscan.cf
  11. DESC="netflow recorder"
  12. test -f $DAEMON || exit 0
  13. test -f $CONFIG || exit 0
  14. startstop() {
  15. local background=
  16. [[ "$1" != "--start" ]] || background="--background"
  17. start-stop-daemon "$@" $background --make-pidfile --name ${DAEMON##*/} \
  18. --pidfile="/var/run/${DAEMON##*/}.pid" --startas "$DAEMON"
  19. }
  20. case "$1" in
  21. start)
  22. echo -n "Starting $DESC: "
  23. startstop --start
  24. echo "${DAEMON##*/}."
  25. ;;
  26. stop)
  27. echo -n "Stopping $DESC: "
  28. startstop --stop
  29. echo "${DAEMON##*/}."
  30. ;;
  31. restart|force-reload)
  32. echo -n "Reloading $DESC: "
  33. startstop --stop --oknodo --quiet
  34. startstop --start
  35. echo "${DAEMON##*/}."
  36. ;;
  37. *)
  38. echo "Usage: $0 {start|stop|restart|force-reload}" >&2
  39. exit 1
  40. ;;
  41. esac
  42. exit 0