LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File init.d-graylog-web-interface of Package graylog2-web-interface (Project home:porscheinformatik:monitoring)

#! /bin/sh
### BEGIN INIT INFO
# Provides:          graylog2-web-interface
# Required-Start:    $network $named $remote_fs $syslog
# Required-Stop:     $network $named $remote_fs $syslog
# Default-Start:     2 3 5
# Default-Stop:      0 1 6
# Short-Description: Graylog2 Web
# Description:       Graylog2 Web - Search your logs, create charts, send reports and be alerted when something happens.
### END INIT INFO

# Author: Lee Briggs <lee@leebriggs.co.uk>

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

# Pull in sysconfig settings
[ -f /etc/sysconfig/graylog2-web-interface ] && . /etc/sysconfig/graylog2-web-interface

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Graylog2 Web"
NAME=graylog2-web-interface
CMD=${WEB_HOME}/bin/graylog2-web-interface
PID_FILE=/var/run/graylog2/${NAME}.pid
LOCKFILE=/var/lock/subsys/$NAME
RUN=no

# Exit if the package is not installed
[ -e "$CMD" ] || exit 0

start() {
    echo -n $"Starting ${NAME}: "
    daemon --user $WEB_USER "nohup $CMD -Dconfig.file=${WEB_CONF} -Dlogger.file=${WEB_LOG_CONF} -Dpidfile.path=${PID_FILE} -Dhttps.keyStore=${WEB_KEYSTORE} ${WEB_CMD_PARAMS} 2> /dev/null "
    RETVAL=$?
    echo 
    sleep 2
    [ $RETVAL = 0 ] && touch ${LOCKFILE}
    return $RETVAL
}

stop() {
    echo -n $"Stopping ${NAME}: "
    killproc -p ${PID_FILE} -d 10 $CMD
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${PID_FILE} && rm -f ${LOCKFILE}
    return $RETVAL
}

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

exit $RETVAL