<commit_before>#!/bin/sh

cmd=$1

restart() {
  stop
  start
}

stop() {
  pid=$(cat ./chihiro_monitor.pid)
  if [ -n "$pid" ]; then
    kill -9 $pid
  fi
  pid=$(ps aux | grep 'node .' | grep -v grep | awk '{print $2}')
  if [ -n "$pid" ]; then
    kill -9 $pid
  fi
}

start() {
  if [ -f "./chihiro_monitor.pid" ]; then
    stop
  fi
  at now -f ./chihiro_monitor.sh
}


if [ "$cmd" = "start" ]; then
  start
elif [ "$cmd" = "stop" ]; then
  stop
elif [ "$cmd" = "restart" ]; then
  restart
else
  echo error input 
fi<commit_msg>bugfix check monitor script using pid instead of files<commit_after>#!/bin/sh

cmd=$1

restart() {
  stop
  start
}

stop() {
  pid=$(cat ./chihiro_monitor.pid)
  if [ -n "$pid" ]; then
    kill -9 $pid
    rm -f ./chihiro_monitor.pid
  fi
  pid=$(ps aux | grep 'node .' | grep -v grep | awk '{print $2}')
  if [ -n "$pid" ]; then
    kill -9 $pid
  fi
}

start() {
  pid=$(cat ./chihiro_monitor.pid)
  procss=$(ps aux | grep $pid | grep -v grep)
  if [ -n "$procss" ]; then
    stop
  fi
  at now -f ./chihiro_monitor.sh
}

if [ "$cmd" = "start" ]; then
  start
elif [ "$cmd" = "stop" ]; then
  stop
elif [ "$cmd" = "restart" ]; then
  restart
else
  echo error input 
fi
{'fraction_non_alphanumeric': 0.183402489626556, 'fraction_numerical': 0.006639004149377593, 'mean_word_length': 2.4555873925501435, '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': '3588472', 'n_tokens_mistral': 503, 'n_tokens_neox': 492, 'n_words': 149}