Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.17 KB | None | 0 0
  1. # Building ignored hosts filter
  2. HOSTS=$(echo -e "${IGNORED_HOSTS}" | grep -Ev "^$" | tr '\n' ' ' | sed -e 's/^/\^/g; s/$/\$/g; s/\ /\$\|\^/g;');
  3. if [ -z ${HOSTS} ]; then
  4.   IHOSTS="^$";
  5. else
  6.   IHOSTS="(${HOSTS})";
  7. fi;
  8.  
  9. # Building ignored paths filter
  10. PATHS=$(echo -e "${IGNORED_PATHS}" | grep -Ev "^$" | tr '\n' ' ' | sed -e 's/^/\^/g; s/$/\$/g; s/\ /\$\|\^/g;');
  11. if [ -z ${PATHS} ]; then
  12.   IPATHS="^$";
  13. else
  14.   IPATHS="(${PATHS})";
  15. fi;
  16.  
  17. # Getting subfolders, filtering out ignored
  18. HOSTS=$( cd ${LOGS}; find . -maxdepth 1 -type d | cut -c3- | grep -Ev "(${IHOSTS})" | sort);
  19. # Looping through subfolders to get filenames
  20. for i in $(echo -e "${HOSTS}"); do
  21.   # Looping through filenames to get unique paths within 30 days
  22.   for j in $( cd ${LOGS}/${i}; find . -mtime -30 -type f | sed -re 's/^\.\///g; s/\-[0-9]{8}\.gz$//g;' | sort | uniq ); do
  23.     # Checking if new files exists
  24.     if [ $(echo -e "${i}/${j}" | grep -Ec "(${IPATHS})") -eq 0 ] && [ $( find ${LOGS}/${i}/${j}* -mtime -1 -type f | wc -l ) -lt 1 ]; then
  25.       ERRORS=$((${ERRORS}+1));
  26.       if [ ${ERRORS} -eq 1 ]; then draw_line; fi;
  27.       echo -e " === Check failed: ${LOGS}/${i}/${j}";
  28.     fi;
  29.   done;
  30. done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement