Sha256: fa814e51461639a009e1629885438a5db3e6d067be074603a2c8825663baa8b1

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

#!/bin/bash
# chkconfig: - 80 15
### BEGIN INIT INFO
# Provides:          logstash
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:
# Default-Stop:      0 1 6
# Short-Description: Starts logstash
# Description: Logstash agent
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

NAME=@@@NAME@@@

[ -f /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME

LOGSTASH_USER=${NAME}
DAEMON="@@@DAEMON@@@/${NAME}"
SERVICE=agent

PID_FILE=${PIDFILE:-@@@PIDDIR@@@/${NAME}.pid}
LOCK_FILE=${LOCKFILE:-@@@LOCKFILE@@@}
LOG_FILE=${LOGFILE:-@@@LOGDIR@@@/${NAME}.log}

LOGSTASH_PATH_CONF=${LOGSTASH_PATH_CONF:-@@@CONFDIR@@@}
LOGSTASH_LOGLEVEL=${LOGSTASH_LOGLEVEL:-"warn"}

DAEMON_OPTS="\
  -P ${PID_FILE} \
  -l ${LOG_FILE} \
  -f ${LOGSTASH_PATH_CONF} \
  -v $LOGSTASH_LOGLEVEL \
"

start() {
    echo -n $"Starting ${NAME}: "
    export JAVA_OPTS="$JAVA_OPTS $LOGSTASH_JAVA_OPTS"
    daemon --pidfile=${PID_FILE} --user $LOGSTASH_USER $DAEMON $SERVICE $DAEMON_OPTS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCK_FILE
    return $RETVAL
}

stop() {

    echo -n $"Stopping ${NAME}: "
    killproc -p ${PID_FILE} -d 10 $DAEMON
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${LOCK_FILE} ${PID_FILE}
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status -p ${PID_FILE} $DAEMON
        RETVAL=$?
        ;;
    restart|force-reload)
        stop
        start
        ;;
    *)
        N=/etc/init.d/${NAME}
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        RETVAL=2
        ;;
esac

exit $RETVAL

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 pkg/rpm/SOURCES/logstash.init