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