Skip to content

Commit

Permalink
feat: find a single file in the db
Browse files Browse the repository at this point in the history
I just outstrip the logic from the
function that check all missing files in the db
so one can have more control/granularity if needed.

Please note that it is is faster to perform the query
in a single call (`report_hf_files` function).
  • Loading branch information
ocehugo committed May 28, 2021
1 parent 3de8c09 commit de412db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ACORN/hfradar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,13 @@ hf_all_stations_in_db() {
report_hf_all_schemas station | awk '{print $1, $NF}' | tr -d '' | tr -d '' | sed -e "s/,//g" | sort | uniq
}

find_hf_file_in_db() {
file=$(echo "$1" | cut -d "." -f1,2)
for address in $(hf_all_sources_in_db);do
extract_query="SELECT file_url FROM $address WHERE file_url LIKE '%$file'"
psql -U "$DBUSER" -w -t -h "$PROD_DB_ADDR" harvest -c "$query" | rev | cut -d "/" -f 1 | rev | sort | xargs
done
}

hf_status_greeting() {
if [ "$1" = 'show' ]; then
Expand Down

0 comments on commit de412db

Please sign in to comment.