<commit_before>DATADIR="/var/lib/omniwallet"

if [ "$1" = "-status" ]; then
  cat $DATADIR/www/revision.json | cut -d"," -f3
  cat $DATADIR/www/revision.json | cut -d"," -f4
  exit
fi

#!/bin/bash
PYTHONBIN=python

kill_child_processes() {
  kill $SERVER_PID
  kill $WEBSOCKET_PID
  rm -f $LOCK_FILE
}

# Ctrl-C trap. Catches INT signal
trap "kill_child_processes 1 $$; exit 0" INT
echo "Starting app.sh: $(TZ='UTC' date)"

echo "Establishing environment variables..."
APPDIR=`pwd`
TOOLSDIR=$APPDIR/node_modules/mastercoin-tools
LOCK_FILE=$DATADIR/msc_cron.lock

# Export directories for API scripts to use
export TOOLSDIR
export DATADIR

echo "Beginning main run loop..."
while true
do

  # check lock (not to run multiple times)
  if [ ! -f $LOCK_FILE ]; then

    # lock
    touch $LOCK_FILE

    #Update debug level
    if [ -e "$DATADIR/debug.level" ]; then
        DEBUGLEVEL=`cat $DATADIR/debug.level`
    else
        DEBUGLEVEL=0
    fi
    export DEBUGLEVEL

    ps cax | grep uwsgi > /dev/null
    if [ $? -eq 0 ]; then
        echo "uwsgi api is running."
      else
        echo "Starting uwsgi daemon..."
        cd $APPDIR/api
        if [[ "$OSTYPE" == "darwin"* ]]; then
          uwsgi -s 127.0.0.1:1088 -p 8 -M --vhost --enable-threads --logto $DATADIR/apps.log &
        else
          uwsgi -s 127.0.0.1:1088 -p 8 -M --vhost --enable-threads --plugin $PYTHONBIN --logto $DATADIR/apps.log &
        fi
        SERVER_PID=$!
        echo $SERVER_PID > /tmp/omniapp.pid
        #get snapshot of directory files
        APISHA=`ls -lR $APPDIR/api/*.py | sha1sum`
    fi

    #check if api files have changed
    CHECKSHA=`ls -lR $APPDIR/api/*.py | sha1sum`
    #Trigger api reload if changed
    if [ "$APISHA" != "$CHECKSHA" ]; then
        uwsgi --reload /tmp/omniapp.pid
        APISHA=$CHECKSHA
        echo Api Reloaded
    fi
<commit_msg>show proxy load balanced ip in log<commit_after>DATADIR="/var/lib/omniwallet"

if [ "$1" = "-status" ]; then
  cat $DATADIR/www/revision.json | cut -d"," -f3
  cat $DATADIR/www/revision.json | cut -d"," -f4
  exit
fi

#!/bin/bash
PYTHONBIN=python

kill_child_processes() {
  kill $SERVER_PID
  kill $WEBSOCKET_PID
  rm -f $LOCK_FILE
}

# Ctrl-C trap. Catches INT signal
trap "kill_child_processes 1 $$; exit 0" INT
echo "Starting app.sh: $(TZ='UTC' date)"

echo "Establishing environment variables..."
APPDIR=`pwd`
TOOLSDIR=$APPDIR/node_modules/mastercoin-tools
LOCK_FILE=$DATADIR/msc_cron.lock

# Export directories for API scripts to use
export TOOLSDIR
export DATADIR

echo "Beginning main run loop..."
while true
do

  # check lock (not to run multiple times)
  if [ ! -f $LOCK_FILE ]; then

    # lock
    touch $LOCK_FILE

    #Update debug level
    if [ -e "$DATADIR/debug.level" ]; then
        DEBUGLEVEL=`cat $DATADIR/debug.level`
    else
        DEBUGLEVEL=0
    fi
    export DEBUGLEVEL

    ps cax | grep uwsgi > /dev/null
    if [ $? -eq 0 ]; then
        echo "uwsgi api is running."
      else
        echo "Starting uwsgi daemon..."
        cd $APPDIR/api
        if [[ "$OSTYPE" == "darwin"* ]]; then
          uwsgi -s 127.0.0.1:1088 -p 8 -M --vhost --enable-threads --log-x-forwarded-for --logto $DATADIR/apps.log &
        else
          uwsgi -s 127.0.0.1:1088 -p 8 -M --vhost --enable-threads --log-x-forwarded-for --plugin $PYTHONBIN --logto $DATADIR/apps.log &
        fi
        SERVER_PID=$!
        echo $SERVER_PID > /tmp/omniapp.pid
        #get snapshot of directory files
        APISHA=`ls -lR $APPDIR/api/*.py | sha1sum`
    fi

    #check if api files have changed
    CHECKSHA=`ls -lR $APPDIR/api/*.py | sha1sum`
    #Trigger api reload if changed
    if [ "$APISHA" != "$CHECKSHA" ]; then
        uwsgi --reload /tmp/omniapp.pid
        APISHA=$CHECKSHA
        echo Api Reloaded
    fi

{'fraction_non_alphanumeric': 0.13044626353313968, 'fraction_numerical': 0.01637179825719567, 'mean_word_length': 2.403414195867026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 4, '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': '3147832', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1376, 'n_words': 382}