Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save skamithi/7c4d8996223e5a98bc6b to your computer and use it in GitHub Desktop.
Save skamithi/7c4d8996223e5a98bc6b to your computer and use it in GitHub Desktop.
Logstash Wrapper for sFlowtool
#!/bin/bash
#
# Wrapper script for sflowtool when used in pipe input in logstash.
# This wrapper script ensures that the sflowtool is not running prior to start of the sflowtool.
ARGS="$@"
SFLOWTOOL_PID=$(/bin/ps -ef | /bin/grep "/usr/bin/sflowtool $ARGS" | /bin/grep -v "grep" | /bin/awk ' { print $2 } ')
if [ ! -z $SFLOWTOOL_PID ]; then
kill -s 9 $SFLOWTOOL_PID
fi
/usr/bin/sflowtool "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment