<commit_before>#!/bin/bash

DYN_DIR=/apps/dynomite
LOG_DIR=/logs/system/dynomite
CONF_DIR=$DYN_DIR/conf

# this code lifted shamelessly from Mike T.'s /etc/init.d/tomcat
# figure out the appropriate user that we should run by
typeset -x `stat --printf "userowner=%U\ngroupowner=%G\n" $0`
mkdir -p $LOG_DIR
chown -R $userowner:nac  $LOG_DIR

DEBUG_STR="-v0"

if [ ! -z "$DYN_DEBUG_LEVEL" ] ; then
   DEBUG_STR="-v$DYN_DEBUG_LEVEL"
fi


# note that we do not use 'su - username .... ' , because we want to keep the env settings that we have done so far
cmd="$DYN_DIR/bin/dynomite -c $CONF_DIR/dynomite.yml -d --output=$LOG_DIR/dynomite.log  $DEBUG_STR  > $LOG_DIR/dynomite_start-$(date +%Y%m%d_%H:%M:%S).out 2>&1 &"
if [ $USER != "root" ];then
    exec $cmd
else
    su  $userowner -c "$cmd"
fi

<commit_msg>launch_dynomite updated script from Minh<commit_after>#!/bin/bash
# Script launched by Florida.
#

# Start redis-server if not running
if ! (ps -ef | grep -q '[/]apps/nfredis/bin/redis-server'); then
    (/apps/nfredis/bin/launch_nfredis.sh &)
fi

# ** This check has to be after the redis check above.
# Quit if Dynomite is already running, rather than
# throwing errors from this script.
if (ps -ef | grep  '[/]apps/dynomite/bin/dynomite'); then
    logger -s "Dynomite already running, no need to restart it again."
    exit 0
fi

DYN_DIR=/apps/dynomite
LOG_DIR=/logs/dynomite
CONF_DIR=$DYN_DIR/conf

source /etc/profile.d/netflix_environment.sh

declare -x `stat --printf "userowner=%U\ngroupowner=%G\n" "$0"`

if [ ! -d "$LOG_DIR" ]; then
    sudo mkdir -p $LOG_DIR
    sudo chown -R $userowner:$groupowner $LOG_DIR
fi

#save the previous log
if [ -e $LOG_DIR/dynomite.log ]; then
    mv $LOG_DIR/dynomite.log $LOG_DIR/dynomite-$(date +%Y%m%d_%H%M%S).log
fi

# note that we do not use 'su - username .... ' , because we want to keep the env settings that we have done so far
cmd="$DYN_DIR/bin/dynomite -d -c $CONF_DIR/dynomite.yml --output=$LOG_DIR/dynomite.log && sudo /apps/dynomite/bin/core_affinity.sh"

echo "Running command: $cmd"

sudo sh -c "ulimit -c unlimited &&  exec sudo /usr/local/bin/setuidgid $NETFLIX_APPUSER $cmd"


{'fraction_non_alphanumeric': 0.1417910447761194, 'fraction_numerical': 0.002798507462686567, 'mean_word_length': 3.7666666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2448473', 'n_tokens_mistral': 854, 'n_tokens_neox': 819, 'n_words': 233}