Skip to content

Instantly share code, notes, and snippets.

@xiocode
Created September 6, 2016 05:36
Show Gist options
  • Select an option

  • Save xiocode/3368b20f7d673e230f0069387415304d to your computer and use it in GitHub Desktop.

Select an option

Save xiocode/3368b20f7d673e230f0069387415304d to your computer and use it in GitHub Desktop.
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export PATH
LOGSTASHPID=`ps ux | grep logstash | grep java | grep agent | awk '{ print $2 }'`
if [ "x$LOGSTASHPID" = "x" ]; then
echo "logstash not running!"
service logstash restart
else
echo $LOGSTASHPID
kill -9 $LOGSTASHPID
service logstash restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment