Forked from whiskeyalpharomeo/logstash-sflowtool-wrapper.sh
Created
December 4, 2015 05:07
-
-
Save skamithi/7c4d8996223e5a98bc6b to your computer and use it in GitHub Desktop.
Logstash Wrapper for sFlowtool
This file contains hidden or 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