<commit_before>#!/bin/bash
# Managed by Puppet
# Restore Database exports created on master
SCRIPTNAME=$(basename $0)

manage_service() {
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Attempting to ${1} service ${2}..."

  [ $1 == 'stop' ]  && ACTION='stopped'
  [ $1 == 'start' ] && ACTION='running'

  OUTPUT=$(/opt/puppetlabs/bin/puppet resource service $2 ensure=$ACTION)
  if [ $? -ne 0 ]; then
    logger "PE_FAILOVER: ${SCRIPTNAME} ---> [FAILURE] Failed to ${1} service ${2}; exiting!"
    exit 1
  fi
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Completed ${1} on service ${2}"
}


# Main
logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Started."

# Create Lockfile
if [ ! -f "/var/tmp/${SCRIPTNAME}.lock" ]; then
  touch "/var/tmp/${SCRIPTNAME}.lock"
else
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [WARNING] Script Already running! Exiting..."
  exit 0
fi

# Set dump location for DB exports to restore
DUMP_LOCATION="<%= @dump_path %>"
<commit_msg>Switching to use globally accepted string compare<commit_after>#!/bin/bash
# Managed by Puppet
# Restore Database exports created on master
SCRIPTNAME=$(basename $0)

manage_service() {
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Attempting to ${1} service ${2}..."

  [ $1 = 'stop' ]  && ACTION='stopped'
  [ $1 = 'start' ] && ACTION='running'

  OUTPUT=$(/opt/puppetlabs/bin/puppet resource service $2 ensure=$ACTION)
  if [ $? -ne 0 ]; then
    logger "PE_FAILOVER: ${SCRIPTNAME} ---> [FAILURE] Failed to ${1} service ${2}; exiting!"
    exit 1
  fi
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Completed ${1} on service ${2}"
}


# Main
logger "PE_FAILOVER: ${SCRIPTNAME} ---> [SUCCESS] Started."

# Create Lockfile
if [ ! -f "/var/tmp/${SCRIPTNAME}.lock" ]; then
  touch "/var/tmp/${SCRIPTNAME}.lock"
else
  logger "PE_FAILOVER: ${SCRIPTNAME} ---> [WARNING] Script Already running! Exiting..."
  exit 0
fi

# Set dump location for DB exports to restore
DUMP_LOCATION="<%= @dump_path %>"

{'fraction_non_alphanumeric': 0.18282828282828284, 'fraction_numerical': 0.013131313131313131, 'mean_word_length': 3.9649122807017543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4200701', 'n_tokens_mistral': 753, 'n_tokens_neox': 691, 'n_words': 196}