<commit_before>#!/bin/bash
#
# Elasticsearch init script for Instance <%= @name -%>
# The chef_elasticsearch cookbook manages me.
#
. /lib/lsb/init-functions

PIDFILE="<%= @pid_file %>"
DAEMON="elasticsearch-<%= @name %>"

if [ -f <%= @env_vars_file -%> ]; then
  . <%= @env_vars_file %>
fi

case "$1" in

  start)
    log_daemon_msg "Starting ES Instance [<%= @name -%>]: "
    <% if @mlockall -%>
    ulimit -l unlimited
    <% end -%>
    su - <%= @user -%> -c ". <%= @env_vars_file %>; <%= @bin_path %> -p ${PIDFILE}" > /dev/null
    log_end_msg $?
  ;;

  stop)
    log_daemon_msg "Stopping ES Instance [<%= @name %>]"
    if [ -f "$PIDFILE" ]; then
      start-stop-daemon --stop --pidfile "$PIDFILE" --user "<%= @user %>" --retry=TERM/20/KILL/5 > /dev/null
      if [ $? -eq 1 ]; then
        log_progress_msg "$DAEMON is not running but pid exists. Cleaning up"
      elif [ $? -eq 3 ]; then
        PID="`cat $PIDFILE`"
        log_failure_msg "Failed to stop $DAEMON (pid $PID)"
        exit 1
      fi
      rm -f "$PIDFILE"
    else
        log_progres_msg "(not running)"
    fi
    log_end_msg 0
  ;;

  status)
  status_of_proc -p $PIDFILE elasticsearch ${DAEMON} && exit 0 || exit $?
  ;;

  *)
    echo "Usage $0 {start|stop|status}"
    exit 1
  ;;

esac
exit 0<commit_msg>changing startup a bit to be more appropriate<commit_after>#!/bin/bash
#
# Elasticsearch init script for Instance <%= @name -%>
# The chef_elasticsearch cookbook manages me.
#
. /lib/lsb/init-functions

PIDFILE="<%= @pid_file %>"
DAEMON="elasticsearch-<%= @name %>"

if [ -f <%= @env_vars_file -%> ]; then
  . <%= @env_vars_file %>
fi

case "$1" in

  start)
    log_daemon_msg "Starting ES Instance [<%= @name -%>]: "
    <% if @mlockall -%>
    ulimit -l unlimited
    <% end -%>
    start-stop-daemon --start -b --user "<%= @user %>" -c "<%= @user %>" --pidfile "${PIDFILE}" --exec <%= @bin_path %> -- -p ${PIDFILE}
    #su - <%= @user -%> -c ". <%= @env_vars_file %>; <%= @bin_path %> -p ${PIDFILE}" > /dev/null
    log_end_msg $?
  ;;

  stop)
    log_daemon_msg "Stopping ES Instance [<%= @name %>]"
    if [ -f "$PIDFILE" ]; then
      start-stop-daemon --stop --pidfile "$PIDFILE" --user "<%= @user %>" --retry=TERM/20/KILL/5 > /dev/null
      if [ $? -eq 1 ]; then
        log_progress_msg "$DAEMON is not running but pid exists. Cleaning up"
      elif [ $? -eq 3 ]; then
        PID="`cat $PIDFILE`"
        log_failure_msg "Failed to stop $DAEMON (pid $PID)"
        exit 1
      fi
      rm -f "$PIDFILE"
    else
        log_progress_msg "(not running)"
    fi
    log_end_msg 0
  ;;

  status)
  status_of_proc -p $PIDFILE elasticsearch ${DAEMON} && exit 0 || exit $?
  ;;

  *)
    echo "Usage $0 {start|stop|status}"
    exit 1
  ;;

esac
exit 0
{'fraction_non_alphanumeric': 0.18670541227751544, 'fraction_numerical': 0.008717762440973484, 'mean_word_length': 2.4904942965779466, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 36, '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': '4613683', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1029, 'n_words': 265}