<commit_before>#!/bin/bash

#HASS_LOGFILE="/home/homeassistant/.homeassistant/2017-09-19-home-assistant.log" 
HASS_LOGDIR="/home/homeassistant/.homeassistant"
HASS_FILENAME="home-assistant.log"
echo "$HASS_LOGDIR"
echo "$HASS_FILENAME"

HASS_LOGFILE=${HASS_LOGDIR}/${HASS_FILENAME}
LOG_CONDITION="Update\sof\sswitch\.[A-Za-z]*\sis\staking\sover\s10\sseconds"

LOG_DATE_TIME=$(date +'%Y-%m-%d_%H:%M:%S')
CP_LOGFILE="cp $HASS_LOGFILE $HASS_LOGDIR/$LOG_DATE_TIME-$HASS_FILENAME"

NO_ERRORS=$(grep -c $LOG_CONDITION $HASS_LOGFILE)

echo "$HASS_LOGFILE"
echo "$NO_ERRORS"
echo "$LOG_DATE_TIME"

if [ $NO_ERRORS -gt "10" ]
then    echo "error found"
        runuser -l homeassistant -c "$CP_LOGFILE"
        systemctl restart <EMAIL> 
fi<commit_msg>added error check for hass errors<commit_after>#!/bin/bash

HASS_LOGDIR="/home/homeassistant/.homeassistant"
HASS_FILENAME="home-assistant.log"
HASS_LOGFILE=${HASS_LOGDIR}/${HASS_FILENAME}
LOG_CONDITION="Update\sof\sswitch\.[A-Za-z]*\sis\staking\sover\s10\sseconds"
LOG_DATE_TIME=$(date +'%Y-%m-%d_%H:%M:%S')
CP_LOGFILE="cp $HASS_LOGFILE $HASS_LOGDIR/$LOG_DATE_TIME-$HASS_FILENAME" #command to backup the logfile


NO_ERRORS=$(grep -c $LOG_CONDITION $HASS_LOGFILE)


if [ $NO_ERRORS -gt "10" ]
then    echo "error found"
        runuser -l homeassistant -c "$CP_LOGFILE"
        systemctl restart <EMAIL> 
fi
{'fraction_non_alphanumeric': 0.15840118430792005, 'fraction_numerical': 0.011843079200592153, 'mean_word_length': 5.627450980392157, 'pattern_counts': {'":': 0, '<': 5, '<?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': '800875', 'n_tokens_mistral': 582, 'n_tokens_neox': 567, 'n_words': 82}