Created
February 20, 2014 07:49
-
-
Save aravindgv/9108755 to your computer and use it in GitHub Desktop.
graylog2-server Startup Script
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/sh | |
#Aravind G V | |
# graylog2-server: graylog2 message collector | |
# | |
# chkconfig: - 98 02 | |
# description: This daemon listens for syslog and GELF messages and stores them in mongodb | |
# | |
CMD=$1 | |
NOHUP=`which nohup` | |
JAVA_HOME=/usr/java/latest | |
JAVA_CMD=/usr/bin/java | |
GRAYLOG2_SERVER_HOME=/opt/graylog2-server | |
start() { | |
echo "Starting graylog2-server ..." | |
$NOHUP $JAVA_CMD -jar $GRAYLOG2_SERVER_HOME/graylog2-server.jar > | |
/var/log/graylog2.log 2>&1 & | |
} | |
stop() { | |
PID=`cat /tmp/graylog2.pid` | |
echo "Stopping graylog2-server ($PID) ..." | |
kill $PID | |
} | |
restart() { | |
echo "Restarting graylog2-server ..." | |
stop | |
start | |
} | |
case "$CMD" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo "Usage $0 {start|stop|restart}" | |
RETVAL=1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment