<commit_before>#!/bin/sh

scriptname=`basename $0`
scriptdir=${0/$scriptname/}
logfile=$scriptdir/logrotate.log

source $scriptdir/config
source $scriptdir/redirectlog.src.sh

lf=$1

if [ ! -f "$lf" ]; then
	echo "file \"$lf\" doesn't exist."
	exit 1
fi

echo "rotating $lf..."
if [ -f $lf.$keepcount ]; then
	echo "  removing $lf.$keepcount"
	rm $lf.$keepcount
fi

i=$((keepcount - 1))
while [ $i -ge 0 ]; do
	if [ -f $lf.$i ]; then
		echo "  moving $lf.$i to $lf.$((i + 1))"
		mv $lf.$i $lf.$((i + 1))
	fi
	i=$((i - 1))
done

echo "  moving $lf to $lf.0"
mv $lf $lf.0
echo "  done."

$scriptdir/../logrotate/logrotateifneeded.sh $logfile<commit_msg>removed unnecessary logging<commit_after>#!/bin/sh

scriptname=`basename $0`
scriptdir=${0/$scriptname/}
logfile=$scriptdir/logrotate.log

source $scriptdir/config
source $scriptdir/redirectlog.src.sh

lf=$1

if [ ! -f "$lf" ]; then
	exit 1
fi

echo "rotating $lf..."
if [ -f $lf.$keepcount ]; then
	echo "  removing $lf.$keepcount"
	rm $lf.$keepcount
fi

i=$((keepcount - 1))
while [ $i -ge 0 ]; do
	if [ -f $lf.$i ]; then
		echo "  moving $lf.$i to $lf.$((i + 1))"
		mv $lf.$i $lf.$((i + 1))
	fi
	i=$((i - 1))
done

echo "  moving $lf to $lf.0"
mv $lf $lf.0
echo "  done."

$scriptdir/../logrotate/logrotateifneeded.sh $logfile
{'fraction_non_alphanumeric': 0.20703125, 'fraction_numerical': 0.0171875, 'mean_word_length': 3.357142857142857, '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': '3981326', 'n_tokens_mistral': 586, 'n_tokens_neox': 534, 'n_words': 140}