Created
June 16, 2015 22:32
-
-
Save whiskeyalpharomeo/de6728c6e5b0dfa7f8c7 to your computer and use it in GitHub Desktop.
Logstash Wrapper for sFlowtool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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