<commit_before>#!/bin/bash

set -e
set -o pipefail

<% if !p('cf_mysql.mysql.disable_auto_sst') %>
export DISABLE_SST=0
<% end %>
## NOTE: This can run as root user or vcap user,
#        depending on whether called by BOSH during deploy or
#        by the bootstrap errand.

PROC_NAME=mariadb_ctl
RUN_DIR=/var/vcap/sys/run/$PROC_NAME
PIDFILE=$RUN_DIR/$PROC_NAME.pid
MARIADB_JOB_DIR=/var/vcap/jobs/mysql
CONFIG_FILE=$MARIADB_JOB_DIR/config/mariadb_ctl_config.yml
MARIADB_CTRL_PACKAGE=/var/vcap/packages/mariadb_ctrl
MARIADB_CTRL_PREFIX_CMD="${MARIADB_CTRL_PREFIX_CMD:-bash -c -o pipefail}"
LOG_DIR=/var/vcap/sys/log/mysql
LOG_FILE=$LOG_DIR/pre-start.stdout.log

source /var/vcap/packages/cf-mysql-common/pid_utils.sh

# add mysql to path
if [ ! -f /usr/local/bin/mysql ]; then
  log "Adding mysql to path"
  ln -s /var/vcap/packages/mariadb/bin/mysql /usr/local/bin
fi

# add xtrabackup to path
export PATH=$PATH:/var/vcap/packages/xtrabackup/bin

log "pre-start execution script: starting mariadb_ctrl in prestart mode"

# Setup pidguard and logging
log "pre-start execution script: checking for existing instance of $PROC_NAME"
pid_guard $PIDFILE $PROC_NAME

cd $MARIADB_CTRL_PACKAGE

set +e
$MARIADB_CTRL_PREFIX_CMD \
"PATH=$PATH $MARIADB_CTRL_PACKAGE/bin/mariadb_ctrl-prestart \
         -configPath=$CONFIG_FILE \
         2>&1 \
         | tee -a $LOG_FILE \
         | logger -p local1.error -t mariadb_ctrl"
status=$?
set -e

log "pre-start execution script: pre-start completed with error code ${status}"
log "pre-start execution script: completed pre-start execution"<commit_msg>Revert "removing perl dependencies [#139854027]"<commit_after>#!/bin/bash

set -e
set -o pipefail

<% if !p('cf_mysql.mysql.disable_auto_sst') %>
export DISABLE_SST=0
<% end %>
## NOTE: This can run as root user or vcap user,
#        depending on whether called by BOSH during deploy or
#        by the bootstrap errand.

PROC_NAME=mariadb_ctl
RUN_DIR=/var/vcap/sys/run/$PROC_NAME
PIDFILE=$RUN_DIR/$PROC_NAME.pid
MARIADB_JOB_DIR=/var/vcap/jobs/mysql
CONFIG_FILE=$MARIADB_JOB_DIR/config/mariadb_ctl_config.yml
MARIADB_CTRL_PACKAGE=/var/vcap/packages/mariadb_ctrl
MARIADB_CTRL_PREFIX_CMD="${MARIADB_CTRL_PREFIX_CMD:-bash -c -o pipefail}"
LOG_DIR=/var/vcap/sys/log/mysql
LOG_FILE=$LOG_DIR/pre-start.stdout.log

source /var/vcap/packages/cf-mysql-common/pid_utils.sh

# add mysql to path
if [ ! -f /usr/local/bin/mysql ]; then
  log "Adding mysql to path"
  ln -s /var/vcap/packages/mariadb/bin/mysql /usr/local/bin
fi

# add xtrabackup to path
export PATH=$PATH:/var/vcap/packages/xtrabackup/bin

# add perl libraries to perl env
export PERL5LIB=$PERL5LIB:/var/vcap/packages/xtrabackup/lib/perl/5.18.2

log "pre-start execution script: starting mariadb_ctrl in prestart mode"

# Setup pidguard and logging
log "pre-start execution script: checking for existing instance of $PROC_NAME"
pid_guard $PIDFILE $PROC_NAME

cd $MARIADB_CTRL_PACKAGE

set +e
$MARIADB_CTRL_PREFIX_CMD \
"PATH=$PATH PERL5LIB=$PERL5LIB $MARIADB_CTRL_PACKAGE/bin/mariadb_ctrl-prestart \
         -configPath=$CONFIG_FILE \
         2>&1 \
         | tee -a $LOG_FILE \
         | logger -p local1.error -t mariadb_ctrl"
status=$?
set -e

log "pre-start execution script: pre-start completed with error code ${status}"
log "pre-start execution script: completed pre-start execution"
{'fraction_non_alphanumeric': 0.11264230077890952, 'fraction_numerical': 0.007489514679448772, 'mean_word_length': 4.274881516587678, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6636804', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1253, 'n_words': 282}