Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Mar 28, 2024
1 parent 59615a0 commit a6b89d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
15 changes: 11 additions & 4 deletions parked.sh
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 0 additions & 12 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a6b89d6

Please sign in to comment.