<commit_before>#!/bin/bash

# update.sh is run periodically by a cronjob.
# * It synchronises the local copy of upsdiagd with the current github BRANCH
# * It checks the state of and (re-)starts daemons if they are not (yet) running.

HOSTNAME=$(cat /etc/hostname)
BRANCH=$(cat "$HOME/.upsdiagd.branch")
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Wait for the daemons to finish their job. Prevents stale locks when restarting.
#echo "Waiting 30s..."
#sleep 30

# make sure working tree exists
if [ ! -d /tmp/upsdiagd/site/img ]; then
  mkdir -p /tmp/upsdiagd/site/img
  chmod -R 755 /tmp/upsdiagd
fi
# make sure working tree exists
if [ ! -d /tmp/upsdiagd/mysql ]; then
  mkdir -p /tmp/upsdiagd/mysql
  chmod -R 755 /tmp/upsdiagd
fi

pushd "${SCRIPT_DIR}/upsdiagd" || exit 1
  # shellcheck disable=SC1091
  source ./includes
  git fetch origin
  # Check which files have changed
  DIFFLIST=$(git --no-pager diff --name-only "$BRANCH..origin/$BRANCH")
  git pull<commit_msg>Detach from $HOME<commit_after>#!/bin/bash

# update.sh is run periodically by a cronjob.
# * It synchronises the local copy of upsdiagd with the current github BRANCH
# * It checks the state of and (re-)starts daemons if they are not (yet) running.

HOSTNAME=$(cat /etc/hostname)
BRANCH=$(cat "$HOME/.upsdiagd.branch")
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Wait for the daemons to finish their job. Prevents stale locks when restarting.
#echo "Waiting 30s..."
#sleep 30

# make sure working tree exists
if [ ! -d /tmp/upsdiagd/site/img ]; then
  mkdir -p /tmp/upsdiagd/site/img
  chmod -R 755 /tmp/upsdiagd
fi
# make sure working tree exists
if [ ! -d /tmp/upsdiagd/mysql ]; then
  mkdir -p /tmp/upsdiagd/mysql
  chmod -R 755 /tmp/upsdiagd
fi

pushd "${SCRIPT_DIR}" || exit 1
  # shellcheck disable=SC1091
  source ./includes
  git fetch origin
  # Check which files have changed
  DIFFLIST=$(git --no-pager diff --name-only "$BRANCH..origin/$BRANCH")
  git pull
{'fraction_non_alphanumeric': 0.13085052843482636, 'fraction_numerical': 0.01610468042274786, 'mean_word_length': 3.6018518518518516, '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': '279994', 'n_tokens_mistral': 745, 'n_tokens_neox': 690, 'n_words': 237}