<commit_before>#!/bin/sh
### BEGIN INIT INFO
# Provides:          consul
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# chkconfig: 2345 96 20
# Short-Description: Consul Service Discovery Platform
# Description:       Consul is a tool for discovering and configuring services
#                    in your infrastructure. It provides several key features:
#                       * Service Discovery
#                       * Health Checking
#                       * Key/Valuye Store
#                       * Multi Datacenter
### END INIT INFO

# load config
if [ -f /opt/cloudconductor/config ]; then
  source /opt/cloudconductor/config
fi

if [ -n "${JOIN_ADDRESS}" ]; then
  if [ -n "`ip addr | grep " ${JOIN_ADDRESS}/"`" ]; then
    CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -bootstrap -config-dir <%= @config_dir %>"
  else
    CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -join ${JOIN_ADDRESS} -config-dir <%= @config_dir %>"
  fi
else
  CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -bootstrap -config-dir <%= @config_dir %>"
fi

NAME="consul"

PIDFILE="/var/run/$NAME.pid"
LOGFILE="/var/log/$NAME.log"

get_pid() {
    pgrep -f <%= @consul_binary %>
}

is_running() {
    ps "`get_pid`" > /dev/null 2>&1
}

case "$1" in
    start)
    if is_running; then
        echo "$NAME already running"
    else
        echo "Starting $NAME"
        su -l `id -u -n` -c "$CMD >> \"$LOGFILE\" &"
        if ! is_running; then
            echo "Unable to start $NAME, see $LOGFILE"
            exit 1
        fi
    fi
    ;;
    stop)<commit_msg>Modify not to load extra environmental variables such as HTTP_PROXY.<commit_after>#!/bin/sh
### BEGIN INIT INFO
# Provides:          consul
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# chkconfig: 2345 96 20
# Short-Description: Consul Service Discovery Platform
# Description:       Consul is a tool for discovering and configuring services
#                    in your infrastructure. It provides several key features:
#                       * Service Discovery
#                       * Health Checking
#                       * Key/Valuye Store
#                       * Multi Datacenter
### END INIT INFO

# load config
if [ -f /opt/cloudconductor/config ]; then
  source /opt/cloudconductor/config
fi

if [ -n "${JOIN_ADDRESS}" ]; then
  if [ -n "`ip addr | grep " ${JOIN_ADDRESS}/"`" ]; then
    CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -bootstrap -config-dir <%= @config_dir %>"
  else
    CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -join ${JOIN_ADDRESS} -config-dir <%= @config_dir %>"
  fi
else
  CMD="<%= @consul_binary %> agent -server -client 0.0.0.0 -bootstrap -config-dir <%= @config_dir %>"
fi

NAME="consul"

PIDFILE="/var/run/$NAME.pid"
LOGFILE="/var/log/$NAME.log"

get_pid() {
    pgrep -f <%= @consul_binary %>
}

is_running() {
    ps "`get_pid`" > /dev/null 2>&1
}

case "$1" in
    start)
    if is_running; then
        echo "$NAME already running"
    else
        echo "Starting $NAME"
        $CMD >> "$LOGFILE" &
        if ! is_running; then
            echo "Unable to start $NAME, see $LOGFILE"
            exit 1
        fi
    fi
    ;;
    stop)
{'fraction_non_alphanumeric': 0.13808267370272648, 'fraction_numerical': 0.01817648783347992, 'mean_word_length': 2.228003784295175, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '4544129', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1095, 'n_words': 328}