Created
February 11, 2015 09:17
-
-
Save magnuspalmer/51e83f0c680ce277f977 to your computer and use it in GitHub Desktop.
RedHat initscript for Elasticsearch
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
| ### BEGIN INIT INFO | |
| # Provides: elasticsearch | |
| # Required-Start: | |
| # Required-Stop: | |
| # Default-Start: 3 5 | |
| # Default-Stop: 0 6 | |
| # Short-Description: ElasticSearch | |
| # Description: ElasticSearch | |
| # NoSQL database used by Graylog2 | |
| ### END INIT INFO | |
| # Source function library. | |
| . /etc/init.d/functions | |
| # Process name ( For display ) | |
| NAME=elasticsearch | |
| GRAYLOG2_HOME=/opt/graylog2 | |
| export GRAYLOG2_HOME | |
| ES_HOME=$GRAYLOG2_HOME/elasticsearch | |
| export ES_HOME | |
| JAVA_HOME=$GRAYLOG2_HOME/java | |
| export JAVA_HOME | |
| ES_HEAP_SIZE=2g | |
| export ES_HEAP_SIZE | |
| # pid file for the daemon | |
| PIDFILE=/var/run/${NAME}.pid | |
| CONFIG_FILE=$GRAYLOG2_HOME/conf/elasticsearch.yml | |
| RUN_COMMAND=$ES_HOME/bin/elasticsearch | |
| RUN_OPTIONS="-d -p $PIDFILE -Des.config=$CONFIG_FILE" | |
| start(){ | |
| echo -n $"Starting $NAME" | |
| daemon --pidfile $PIDFILE $RUN_COMMAND $RUN_OPTIONS | |
| RETVAL=$? | |
| #[ $RETVAL -eq 0 ] && touch /var/lock/subsys/${NAME} | |
| return $RETVAL | |
| } | |
| stop() { | |
| # Stop the daemon. | |
| echo -n $"Shutting $NAME" | |
| killproc $NAME | |
| } | |
| restart() { | |
| stop | |
| start | |
| } | |
| rhstatus(){ | |
| status $NAME | |
| } | |
| case "$1" in | |
| start) | |
| start | |
| ;; | |
| stop) | |
| stop | |
| ;; | |
| status) | |
| rhstatus | |
| ;; | |
| restart) | |
| restart | |
| ;; | |
| *) | |
| echo $"Usage: $0 {start|stop|status|restart}" | |
| exit 2 | |
| esac | |
| exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment