For those who has log size problem
I wrote some thing until we think of a new way either named pipe, tmpfs, ramfs or ...
3main after :
if [ $CLEAR_LOGS_ON_BOOT == "YES" ]
then
sudo bash '/home/m1/clear_logs'
fi
ADD:
if [ $LOG_ROTATE == "YES" ]
then
HCD='/home/m1/log_rotate'
running=$(ps -ef | awk '$NF~"log_rotate" {print $2}')
if [ "$running" == "" ]
then
guake -n $HCD -r LOG_ROTATE -e "bash /home/m1/log_rotate"
running=""
fi
fi
1bash after :
CLEAR_LOGS_ON_BOOT="NO" # YES NO
ADD:
$LOG_ROTATE="YES"
$LOG_ROTATE_INTERVAL=12 # Time between log rotations in hours
And make a new file
/home/m1/log_rotate
#!/bin/bash
source /home/m1/1bash
while true
do
TIMEIN=$LOG_ROTATE_INTERVAL
TIMEOUT=$(($TIMEIN * 3600))
# Rotating wdog logs
WDOG_LOG_FILE="/home/m1/5_restartlog"
if [ -e "$WDOG_LOG_FILE" ] ; then
#Limit the logfile, just keep the last 2k
echo "$( cat $WDOG_LOG_FILE | tail -n 2k)" > $WDOG_LOG_FILE
fi
# Rotating wdog alerts log
WDOG_ALERT_LOG_FILE="/home/m1/7_wdog_alertlog"
if [ -e "$WDOG_ALERT_LOG_FILE" ] ; then
#Limit the logfile, just keep the last 2k
echo "$( cat $WDOG_ALERT_LOG_FILE | tail -n 2k)" > $WDOG_ALERT_LOG_FILE
fi
# Rotating temp logs
TEMP_LOG_FILE="/home/m1/6_autotemplog"
if [ -e "$TEMP_LOG_FILE" ] ; then
#Limit the logfile, just keep the last 2k
echo "$( cat $TEMP_LOG_FILE | tail -n 2k)" > $TEMP_LOG_FILE
fi
# Rotating temp alerts
TEMP_ALERT_LOG_FILE="/home/m1/7_temp_alertlog"
if [ -e "$TEMP_ALERT_LOG_FILE" ] ; then
#Limit the logfile, just keep the last 2k
echo "$( cat $TEMP_ALERT_LOG_FILE | tail -n 2k)" > $TEMP_ALERT_LOG_FILE
fi
# Rotating miner screenlog
MINER_LOG_FILE="/home/m1/screenlog.0"
if [ -e "$MINER_LOG_FILE" ] ; then
#Limit the logfile, just keep the last 2k
echo "$( cat $MINER_LOG_FILE | tail -n 2k)" > $MINER_LOG_FILE
fi
echo "Rotate again in $TIMEIN Hours"
sleep $TIMEOUT
done
Hope it helps you for now.
Here is another way of thinking that may help too. I started looking at what was in these logs and just how useful it was. I found a couple of things that I changed because I consider it unnecessary.
1) In IAmNotAJeep_and_Maxximus007_WATCHDOG on line 52 we have:
echo " GPU_COUNT: " $GPU_COUNT | tee -a ${LOG_FILE}
and on line 58:
echo "GPU UTILIZATION: " $UTILIZATIONS | tee -a ${LOG_FILE}
Both of these are inside the while loop so they are written to 5_restartlog every 10 seconds. There is plenty of logging elsewhere in the script in the event of problem so I see no need for these and removed them.
2) In 3main, for the case where LOCALorREMOTE=REMOTE, I see that both IAmNotAJeep_and_Maxximus007_WATCHDOG and Maxximus007_AUTO_TEMPERATURE_CONTROL are launched with screen -dmSL (L is for logging to screenlog) on line 330 and 331 respectively. Both of these scripts have their own dedicated logs (7_wdog_alertlog and 6_autotemplog) so this logging is redundant. Removing the "L" from the screen commands for those will reduce log sizes as well. In addition, for those with REMOTE, it will clean up screenlog.0 so that only the miner is logged there. This should make it easier to find and diagnose miner problems.
Hope this helps.
I believe they use $UTILIZATIONS and $GPU_COUNT to show it in telegram message. They need to fetch that info from the log or alternatively query it from within the telegram script itself.
If we switch all logs to reside on the tmpfs it shouldn't be problem logging those if we rotate/flush the logs periodicaly.
As for the logging from 3main, that should definetely be removed.