Artificial intelligent assistant

How to limit the size of log files which are generated by scripts runs at startup So, how can I limit the log file size or how to automate to delete the files, if the files are reached a particular size. Here is the actual scenario PLEASE CHECK HERE. For testing, I deleted log file `/root/folder/my_output_file.log`, while script is running, but after deletion the log file was not regenerated. Or I have do any modifications to script to log the output properly.Thanks

I found some useful code(Even, it is not efficient way to handle the logs files)


#!/bin/bash
MaxFileSize=10000000
#Max file size 10MB
while true
do
python /root/rtt/rtt.py >> /root/script_logs/rtt.log
sleep 60
com=`du -b /root/script_logs/rtt.log`
file_size=`echo $com | cut -d' ' -f1`
if [[ "$file_size" -gt "$MaxFileSize" ]]
then
echo ' ' > /root/script_logs/rtt.log
fi
done

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e280dcc593a9321c3c1c1c250c76bf24