<commit_before>#!/usr/bin/env bash

SCRIPT_PATH=$(readlink -f "$0")

cd /opt/heylex.us-agent/


INITIAL_UPDATER_HASH=$(shasum force-update.sh)
INITIAL_SUPERVISOR_HASH=$(shasum heylex-agent.conf)

git fetch --all
git reset --hard origin/master

UPDATED_UPDATER_HASH=$(shasum force-update.sh)
UPDATED_SUPERVISOR_HASH=$(shasum heylex-agent.conf)

if [ "$INITIAL_UPDATER_HASH" != "$UPDATED_UPDATER_HASH" ]; then
    exec "$SCRIPT_PATH"
fi

if [ "$INITIAL_SUPERVISOR_HASH" != "$UPDATED_SUPERVISOR_HASH" ]; then
    sudo cp heylex-agent.conf /etc/supervisor/conf.d/heylex-agent.conf
    sudo supervisorctl reload heylex-agent
fi

echo "Better? Mabe.."

npm install
sudo supervisorctl restart heylex-agent<commit_msg>Only restarting if code changed<commit_after>#!/usr/bin/env bash

SCRIPT_PATH=$(readlink -f "$0")

cd /opt/heylex.us-agent/

INITIAL_REPO_HASH=$(git rev-parse HEAD)
INITIAL_UPDATER_HASH=$(shasum force-update.sh)
INITIAL_SUPERVISOR_HASH=$(shasum heylex-agent.conf)

git fetch --all
git reset --hard origin/master


UPDATED_REPO_HASH=$(git rev-parse HEAD)
UPDATED_UPDATER_HASH=$(shasum force-update.sh)
UPDATED_SUPERVISOR_HASH=$(shasum heylex-agent.conf)

if [ "$INITIAL_UPDATER_HASH" != "$UPDATED_UPDATER_HASH" ]; then
    exec "$SCRIPT_PATH"
fi

if [ "$INITIAL_SUPERVISOR_HASH" != "$UPDATED_SUPERVISOR_HASH" ]; then
    sudo cp heylex-agent.conf /etc/supervisor/conf.d/heylex-agent.conf
    sudo supervisorctl reload heylex-agent
fi

if [ "$INITIAL_REPO_HASH" != "$UPDATED_REPO_HASH" ]; then
    # Only reload if things have changed
    npm install
    sudo supervisorctl restart heylex-agent
fi
{'fraction_non_alphanumeric': 0.12398753894080997, 'fraction_numerical': 0.0012461059190031153, 'mean_word_length': 5.176923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '569484', 'n_tokens_mistral': 669, 'n_tokens_neox': 625, 'n_words': 119}