<commit_before>#!/bin/bash

if [ `netstat -t | grep -v CLOSE_WAIT | grep ':8787' | wc -l` -lt 3 ]
then
    if [ -e "/tmp/monitor_run" ];
    then
        pkill tail
        # We will create new history elements with all data that is relevant,
        # this means we can delete everything from /import/
        # rm /import/ -rf
    fi
fi

touch /tmp/monitor_run<commit_msg>Update with latest from upstream<commit_after>#!/bin/bash

# Take the netstat output the estimate if the client is still connected to
# the RStudio server. The 'CLOSE_WAIT' state will be ignored. It
# Indicates that the server has received the first FIN signal from the client
# and the connection is in the process of being closed. But that can never happen.
# For some reason there are a few connections open that do not relate the
# client that needs to be connected over the port :8787 If we do not have a
# connection open from port 8787, kill the server and herewith the docker container.

while true; do
    sleep 60

    if [ `netstat -t | grep -v CLOSE_WAIT | grep ':8787' | wc -l` -lt 3 ]
    then
        pkill ipython
        # We will create new history elements with all data that is relevant,
        # this means we can delete everything from /import/
        if [[ "$DEBUG" == "false" ]];
        then
            rm /import/ -rf;
        fi
    fi

done
{'fraction_non_alphanumeric': 0.07360594795539034, 'fraction_numerical': 0.01486988847583643, 'mean_word_length': 2.542105263157895, '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': '6156401', 'n_tokens_mistral': 413, 'n_tokens_neox': 384, 'n_words': 195}