Score:0

How to raise alerts after a certain time frame from the time stamp of the file name?

cn flag
#!/bin/bash

files=()
each_row=()
raw_file_names=()
directory=($(ls /home/cloudera/Downloads/20211006/*))
csv_file=(/home/cloudera/Downloads/log_20211006_1.log)
completed="Completed"


for i in "${directory[@]}"
     do
         files+=("$(echo ${i%%.*} | cut -d'/' -f 6)")
     done



while read -r current_line; 
     do
         each_row+=("$(echo "$current_line")")
     done<$csv_file
    
    
each_row=("${each_row[@]:1}")

echo $each_row



for i in "${each_row[@]}"
     do
         raw_file_names+=("$(echo ${i} | cut -d',' -f 1)")
     done


for i in "${each_row[@]}"
     do
         rawfile=("$(echo ${i} | cut -d',' -f 1)") 
             status_of_file=("$(echo ${i} | cut -d',' -f 2)")
         if [[ $status_of_file != "$completed" ]];
     then
         if !(grep -q "$rawfile not Completed!" alerts.txt); then
                 echo "$rawfile not Completed!"
                 echo "$rawfile not Completed!" >> alerts.txt
         fi
     fi
done



missing_rawfile=("$(echo ${files[@]} ${raw_file_names[@]} | tr ' ' '\n' | sort | uniq -u)")



echo "missing: $missing_rawfile"

for i in "${missing_rawfile}"
      do
        if !(grep -q "$missing_rawfile is Missing from the log!" alerts.txt); then
             echo "$missing_rawfile is Missing from the log!"
             echo "$missing_rawfile is Missing from the log!" >> alerts.txt
        fi
done
bac0n avatar
cn flag
think you mean to do `if ! grep -q "$missing_rawfile..." alerts.txt; then`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.