Fixes for Init files

- Remove the START=true check from all sysv style init files.
- Set the java check to a which command
This commit is contained in:
Richard Pijnenburg 2014-02-13 17:08:39 +01:00
parent 6442fb5be4
commit 0558a8f834
5 changed files with 4 additions and 48 deletions

View file

@ -1,8 +1,5 @@
# defaults for logstash
# Start logstash on boot?
START=no
# pulled in from the init script; makes things easier.
NAME=logstash-web

View file

@ -73,14 +73,6 @@ PID_FILE=/var/run/$NAME.pid
DAEMON=$LS_JAR
DAEMON_OPTS="web"
is_true() {
if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x1" ] ; then
return 0
else
return 1
fi
}
# Check DAEMON exists
if ! test -e $DAEMON; then
log_failure_msg "Daemon $DAEMON doesn't exist"
@ -89,11 +81,6 @@ fi
case "$1" in
start)
if ! is_true "$START" ; then
echo "logstash not configured to start, please edit /etc/default/logstash to enable"
exit 0
fi
if [ -z "$JAVA" ]; then
log_failure_msg "no JDK found - $JAVA"
exit 1

View file

@ -1,8 +1,5 @@
# defaults for logstash
# Start logstash on boot?
START=no
# pulled in from the init script; makes things easier.
NAME=logstash

View file

@ -36,7 +36,7 @@ fi
LS_USER=logstash
LS_GROUP=logstash
JAVA=/usr/bin/java
JAVA=`which java`
# Directory where the logstash all in one jar lives
LS_HOME=/var/lib/logstash
@ -70,31 +70,19 @@ if [ -f "$DEFAULT" ]; then
fi
# Define other required variables
LS_JAR="/opt/logstash/logstash.jar"
PID_FILE=/var/run/$NAME.pid
DAEMON=$LS_JAR
DAEMON_OPTS="agent -f ${CONF_DIR} ${LS_OPTS}"
is_true() {
if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x1" ] ; then
return 0
else
return 1
fi
}
# Check DAEMON exists
if ! test -e $DAEMON; then
log_failure_msg "Daemon $DAEMON doesn't exist"
log_failure_msg "Jar file $DAEMON doesn't exist"
exit 1
fi
case "$1" in
start)
if ! is_true "$START" ; then
echo "logstash not configured to start, please edit /etc/default/logstash to enable"
exit 0
fi
if [ -z "$JAVA" ]; then
log_failure_msg "no JDK found - $JAVA"
exit 1

View file

@ -71,32 +71,19 @@ JAVA=`which java`
JAR="${LS_HOME}/logstash.jar"
ARGS="${LS_JAVA_OPTS} -jar ${JAR} agent --config ${CONF_DIR} --log ${LOG_FILE} -w ${FILTER_THREADS}"
is_true() {
if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x1" ] ; then
return 0
else
return 1
fi
}
#
# Function that starts the daemon/service
#
do_start()
{
if ! is_true "$START" ; then
echo "logstash not configured to start, please edit $DEFAULT to enable"
exit 0
fi
if [ -z "$JAVA" ]; then
echo "no JDK found - $JAVA"
exit 1
fi
if ! test -e "${JAR}"; then
echo "Daemon $DAEMON doesn't exist"
echo "Jar file $JAR doesn't exist"
exit 1
fi