Post
Topic
Board Mining (Altcoins)
Re: [OS] nvOC easy-to-use Linux Nvidia Mining v0019-1.4
by
papampi
on 16/11/2017, 07:15:51 UTC
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 :

Code:
if [ $CLEAR_LOGS_ON_BOOT == "YES" ]
then
sudo bash '/home/m1/clear_logs'
fi


ADD:

Code:
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 :

Code:
CLEAR_LOGS_ON_BOOT="NO"         # YES NO

ADD:

Code:
$LOG_ROTATE="YES"
$LOG_ROTATE_INTERVAL=12 # Time between log rotations in hours

And make a new file

Code:
/home/m1/log_rotate


Code:
#!/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.

is this necessary for all of us? and how to go to the 3main config? thank yoU!

Not at all if you dont have log size problem
Which I never had and I never seen my log sizes go over 10-15 Mb