From a6b89d6e83cedc7cb10fe8457f1fb912a0b6ca23 Mon Sep 17 00:00:00 2001 From: Jarell <91372088+jarelllama@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:58:40 +0800 Subject: [PATCH] Test --- parked.sh | 15 +++++++++++---- test.sh | 12 ------------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/parked.sh b/parked.sh index 893387e59..bbc06b959 100644 --- a/parked.sh +++ b/parked.sh @@ -1,5 +1,8 @@ #!/bin/bash -raw_file='data/raw.txt' +raw_file='data/raw_light.txt' + + + raw_light_file='data/raw_light.txt' parked_terms_file='config/parked_terms.txt' parked_domains_file='data/parked_domains.txt' @@ -10,7 +13,7 @@ function main { for file in config/* data/*; do # Format files in the config and data directory format_list "$file" done - add_unparked_domains + #add_unparked_domains remove_parked_domains update_light_file } @@ -29,9 +32,11 @@ function add_unparked_domains { check_for_unparked "x10" & check_for_unparked "x11" & [[ -f x12 ]] && check_for_unparked "x12" - format_list unparked_domains.tmp find . -maxdepth 1 -type f -name "x??" -delete # Reset split files + [[ ! -f unparked_domains.tmp ]] && return + format_list unparked_domains.tmp + # Remove unparked domains from parked domains file comm -23 "$parked_domains_file" unparked_domains.tmp > parked.tmp && mv parked.tmp "$parked_domains_file" cat unparked_domains.tmp >> "$raw_file" # Add unparked domains to raw file @@ -53,9 +58,11 @@ function remove_parked_domains { check_for_parked "x10" & check_for_parked "x11" & [[ -f x12 ]] && check_for_parked "x12" - format_list parked_domains.tmp find . -maxdepth 1 -type f -name "x??" -delete # Reset split files + [[ ! -f parked_domains.tmp ]] && return + format_list parked_domains.tmp + # Remove parked domains from raw file comm -23 "$raw_file" parked_domains.tmp > raw.tmp && mv raw.tmp "$raw_file" cat parked_domains.tmp >> "$parked_domains_file" # Add parked domains to parked domains file diff --git a/test.sh b/test.sh index 12e7c404f..c590a9397 100644 --- a/test.sh +++ b/test.sh @@ -365,18 +365,6 @@ function check_if_dead_present { error=true } -function check_parked { - while read -r line; do - ! grep -qxF "$line" "$1" && { parked_error=true; break; } # Break when error found - done < "$2" - [[ "$parked_error" != true ]] && return # Return if no error found - printf "! %s file is not as expected." "$3" - printf "\nTerms expected:\n" - cat "$2" - printf "\n" - error=true -} - function check_log { while read -r log_term; do ! grep -qF "$log_term" "$domain_log" && { log_error=true; break; } # Break when error found