<commit_before>#! /bin/sh

# Installed by Chef => graylog2::web-interface.rb

### BEGIN INIT INFO
# Provides:          graylog2-web-interface
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the graylog2 web
# Description:       starts the graylog2 java server using the graylog2 control script
### END INIT INFO

APP=graylog2-web-interface
APP_PATH=<%= node[:graylog2][:web_home] %>
NOHUP=`which nohup`
GRAYLOG2_PID=$APP_PATH/RUNNING_PID

test -x /usr/bin/java || exit 0

set -e

start() {
  echo "Starting graylog2-web-interface ..."
  cd $APP_PATH/bin
  $NOHUP ./graylog2-web-interface -mem <%= node[:graylog2][:web_mem] %> &
}

stop() {
  PID=$(get_pid)
  echo "Stopping graylog2-web-interface ($PID) ..."
  if kill $PID; then
    rm ${GRAYLOG2_PID}
  fi
}

restart() {
  echo "Restarting graylog2-web-interface ..."
  stop
  start
}

status() {
  PID=$(get_pid)
  if [ ! -z $PID ]; then
    if pid_running $PID; then
      echo "graylog2-web-interface running as pid $PID"
      return 0
    else
      echo "Stale pid file with $PID - removing..."
      rm ${GRAYLOG2_PID}
    fi
  fi

  echo "graylog2-web-interface not running"
}

get_pid() {
  cat ${GRAYLOG2_PID} 2> /dev/null
}

pid_running() {
  kill -0 $1 2> /dev/null
}


case "$1" in
  start)
    start
  ;;
  stop)
    stop
  ;;
  status)
    status
  ;;
  restart)<commit_msg>some changes to the init script for g2-web<commit_after>#! /bin/sh

# Installed by Chef => graylog2::web-interface.rb

### BEGIN INIT INFO
# Provides:          graylog2-web-interface
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the graylog2 web
# Description:       starts the graylog2 java server using the graylog2 control script
### END INIT INFO

APP=graylog2-web-interface
APP_PATH=<%= node[:graylog2][:web_home] %>
NOHUP=`which nohup`
GRAYLOG2_PID=$APP_PATH/RUNNING_PID

test -x /usr/bin/java || exit 0

set -e

start() {
  echo "Starting graylog2-web-interface ..."
  cd $APP_PATH/bin
  $NOHUP ./graylog2-web-interface -mem <%= node[:graylog2][:web_mem] %> &
}

stop() {
  if [ -f $GRAYLOG2_PID ];
  then
    PID=`cat ${GRAYLOG2_PID}`
    echo "Stopping graylog2-web-interface ($PID) ..."
    kill $PID
  fi
}

restart() {
    stop
    sleep 2
    start
}

status() {
  PID=`cat ${GRAYLOG2_PID}`
  if [ ! -z $PID ]; then
    if pid_running $PID; then
      echo "graylog2-web-interface running as pid $PID"
      return 0
    else
      echo "Stale pid file with $PID - removing..."
      rm ${GRAYLOG2_PID}
    fi
  fi

  echo "graylog2-web-interface not running"
}

pid_running() {
  kill -0 $1 2> /dev/null
}


case "$1" in
  start)
    start
  ;;
  stop)
    stop
  ;;
  status)
    status
  ;;
  restart)
{'fraction_non_alphanumeric': 0.13928067700987307, 'fraction_numerical': 0.022919605077574047, 'mean_word_length': 2.757615894039735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5210719', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1071, 'n_words': 282}