<commit_before>#!/bin/sh
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
#

. /etc/include.properties
. /etc/device.properties
. /etc/env_setup.sh

export PATH=$PATH:/usr/sbin:/sbin
CRON_SPOOL=/var/spool/cron
# kill any existing crond services
killall crond > /dev/null

cat /dev/null > /tmp/cron_list
# Dump existing cron jobs to a file
crontab -l -c /var/spool/cron/ > /tmp/cron_list

# Regr the log rotate to crontab
if [ -f $RDK_PATH/logRotateDaemon.sh ]; then
     output=`cat /tmp/cron_list | grep logRotateDaemon.sh`
     if [ ! "$output" ]; then
           echo "* * * * * nice -n 19 sh $RDK_PATH/logRotateDaemon.sh" >> /tmp/cron_list
     fi
fi

if [ "$UI_MONITOR_ENABLE" = "true" ]; then
     # Regr the UI Mngr rotate to crontab
     if [ -f $RDK_PATH/uiMngrMonitor.sh ]; then
           output=`cat /tmp/cron_list | grep uiMngrMonitor.sh`
           if [ ! "$output" ]; then
               echo "* * * * * $RDK_PATH/uiMngrMonitor.sh" >> /tmp/cron_list
           fi
     fi
fi

if [ -f $RDK_PATH/diskMon.sh ]; then
      output=`cat /tmp/cron_list | grep diskMon.sh`
      if [ ! "$output" ]; then
           echo "0 * * * * sh $RDK_PATH/diskMon.sh" >> /tmp/cron_list
      fi
fi

if [ -f $RDK_PATH/disk_threshold_check.sh ]; then
      output=`cat /tmp/cron_list | grep disk_threshold_check.sh`
      if [ ! "$output" ]; then
                echo "*/20 * * * * nice -n 19 sh $RDK_PATH/disk_threshold_check.sh 1" >> /tmp/cron_list
      fi
fi

if [ -f $RDK_PATH/mocaStatusLogger.sh ]; then     
       output=`cat /tmp/cron_list | grep mocaStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "0 * * * * nice -n 19 sh $RDK_PATH/mocaStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/upstreamNwStatusLogger.sh ]; then     
       if [ -f /opt/upstreamStats.txt ]; then
             rm /opt/upstreamStats.txt
       fi

       output=`cat /tmp/cron_list | grep upstreamNwStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "*/2 * * * * nice -n 19 sh $RDK_PATH/upstreamNwStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/decoderStatusLogger.sh ]; then
       output=`cat /tmp/cron_list | grep decoderStatusLogger.sh`
       if [ ! "$output" ]; then
                 echo "*/2 * * * * nice -n 19 sh $RDK_PATH/decoderStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/dmesg-logs-timestamp.sh ] && [ -f $RDK_PATH/dmesg_logs.sh ]; then
       output=`cat /tmp/cron_list | grep dmesg-logs-timestamp.sh`
       if [ ! "$output" ]; then
            echo "*/5 * * * * nice -n 19 sh $RDK_PATH/dmesg-logs-timestamp.sh" >> /tmp/cron_list
       fi                     
fi

if [ "$BUILD_TYPE" != "prod" ] && [ -f /lib/rdk/monitor-persistent.sh ];then
       output=`cat /tmp/cron_list | grep monitor-persistent.sh`
       if [ ! "$output" ]; then
            echo "*/5 * * * * sh $RDK_PATH/monitor-persistent.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/hddStatusLogger.sh ]; then     
    if [ "x$DEVICE_NAME" != "xRNG150" ] && [ ! -f /etc/os-release ]; then
       output=`cat /tmp/cron_list | grep hddStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "*/30 * * * * nice -n 19 sh $RDK_PATH/hddStatusLogger.sh" >> /tmp/cron_list
       fi
    fi
fi

if [ "$ENABLE_MULTI_USER" = "true" ];then
   if [ -d /var/spool ] || [ -h /var/spool ];then
     chown -R root /var/spool/*
     chgrp -R root /var/spool/*
   fi
fi
# Starting the cron service
crond -b -L /dev/null -c ${CRON_SPOOL}

# Set new cron job from the file            
crontab /tmp/cron_list -c /var/spool/cron/
<commit_msg>top_log.txt file missing in master loaded boxes<commit_after>#!/bin/sh
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
#

. /etc/include.properties
. /etc/device.properties
. /etc/env_setup.sh

export PATH=$PATH:/usr/sbin:/sbin
CRON_SPOOL=/var/spool/cron
# kill any existing crond services
killall crond > /dev/null

cat /dev/null > /tmp/cron_list
# Dump existing cron jobs to a file
crontab -l -c /var/spool/cron/ > /tmp/cron_list

# Regr the log rotate to crontab
if [ -f $RDK_PATH/logRotateDaemon.sh ]; then
     output=`cat /tmp/cron_list | grep logRotateDaemon.sh`
     if [ ! "$output" ]; then
           echo "* * * * * nice -n 19 sh $RDK_PATH/logRotateDaemon.sh" >> /tmp/cron_list
     fi
fi

if [ "$UI_MONITOR_ENABLE" = "true" ]; then
     # Regr the UI Mngr rotate to crontab
     if [ -f $RDK_PATH/uiMngrMonitor.sh ]; then
           output=`cat /tmp/cron_list | grep uiMngrMonitor.sh`
           if [ ! "$output" ]; then
               echo "* * * * * $RDK_PATH/uiMngrMonitor.sh" >> /tmp/cron_list
           fi
     fi
fi

if [ -f $RDK_PATH/diskMon.sh ]; then
      output=`cat /tmp/cron_list | grep diskMon.sh`
      if [ ! "$output" ]; then
           echo "0 * * * * sh $RDK_PATH/diskMon.sh" >> /tmp/cron_list
      fi
fi

if [ -f $RDK_PATH/disk_threshold_check.sh ]; then
      output=`cat /tmp/cron_list | grep disk_threshold_check.sh`
      if [ ! "$output" ]; then
                echo "*/20 * * * * nice -n 19 sh $RDK_PATH/disk_threshold_check.sh 1" >> /tmp/cron_list
      fi
fi

if [ -f $RDK_PATH/mocaStatusLogger.sh ]; then     
       output=`cat /tmp/cron_list | grep mocaStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "0 * * * * nice -n 19 sh $RDK_PATH/mocaStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/upstreamNwStatusLogger.sh ]; then     
       if [ -f /opt/upstreamStats.txt ]; then
             rm /opt/upstreamStats.txt
       fi

       output=`cat /tmp/cron_list | grep upstreamNwStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "*/2 * * * * nice -n 19 sh $RDK_PATH/upstreamNwStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/decoderStatusLogger.sh ]; then
       output=`cat /tmp/cron_list | grep decoderStatusLogger.sh`
       if [ ! "$output" ]; then
                 echo "*/2 * * * * nice -n 19 sh $RDK_PATH/decoderStatusLogger.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/dmesg-logs-timestamp.sh ] && [ -f $RDK_PATH/dmesg_logs.sh ]; then
       output=`cat /tmp/cron_list | grep dmesg-logs-timestamp.sh`
       if [ ! "$output" ]; then
            echo "*/5 * * * * nice -n 19 sh $RDK_PATH/dmesg-logs-timestamp.sh" >> /tmp/cron_list
       fi                     
fi

if [ "$BUILD_TYPE" != "prod" ] && [ -f /lib/rdk/monitor-persistent.sh ];then
       output=`cat /tmp/cron_list | grep monitor-persistent.sh`
       if [ ! "$output" ]; then
            echo "*/5 * * * * sh $RDK_PATH/monitor-persistent.sh" >> /tmp/cron_list
       fi
fi

if [ -f $RDK_PATH/hddStatusLogger.sh ]; then     
    if [ "x$DEVICE_NAME" != "xRNG150" ] && [ ! -f /etc/os-release ]; then
       output=`cat /tmp/cron_list | grep hddStatusLogger.sh`
       if [ ! "$output" ]; then
             echo "*/30 * * * * nice -n 19 sh $RDK_PATH/hddStatusLogger.sh" >> /tmp/cron_list
       fi
    fi
fi

if [ -f $RDK_PATH/vitalProcessInfo.sh ] && [ ! -f /etc/os-release ]; then
   output=`cat /tmp/cron_list | grep vitalProcessInfo.sh`
   if [ ! "$output" ]; then
         echo "*/10 * * * * nice -n 19 sh $RDK_PATH/vitalProcessInfo.sh" >> /tmp/cron_list
   fi
fi

if [ "$ENABLE_MULTI_USER" = "true" ];then
   if [ -d /var/spool ] || [ -h /var/spool ];then
     chown -R root /var/spool/*
     chgrp -R root /var/spool/*
   fi
fi
# Starting the cron service
crond -b -L /dev/null -c ${CRON_SPOOL}

# Set new cron job from the file            
crontab /tmp/cron_list -c /var/spool/cron/

{'fraction_non_alphanumeric': 0.16400132348075439, 'fraction_numerical': 0.008382044777765524, 'mean_word_length': 2.494412331406551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3066865', 'n_tokens_mistral': 3271, 'n_tokens_neox': 3129, 'n_words': 841}