From 8ef6a0a4360f7ce92575f83897e775b690e0ac7a Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 12 Dec 2011 11:38:07 +0000 Subject: If too many changes are detected it will ignore. --- bug_tracker_change_detector | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bug_tracker_change_detector') diff --git a/bug_tracker_change_detector b/bug_tracker_change_detector index f334337..ac90aac 100755 --- a/bug_tracker_change_detector +++ b/bug_tracker_change_detector @@ -8,6 +8,8 @@ do temp_file=$( mktemp ) + temp_changes=$( mktemp ) + changes="/tmp/un-provoked-message-store" for url in $( curl --compressed "https://bugs.parabolagnulinux.org/bugs/issue?@pagesize=99999" 2> /dev/null | grep -E 'href="issue[[:digit:]]+' | cut -d '"' -f 2 ) @@ -52,7 +54,7 @@ do curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%%1' bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) rm -r "${tdir}" - echo "${bug_number} created: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${changes}" + echo "${bug_number} created: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${temp_changes}" # It is in the log file so now we check if the entire line is there, # because if it's not then the md5sum must have changed. elif { ! grep "${line}" "${log_file}" > /dev/null ; } @@ -61,12 +63,24 @@ do curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%<title>%1' bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) rm -r "${tdir}" - echo "${bug_number} changed: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${changes}" + echo "${bug_number} changed: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title})" >> "${temp_changes}" fi done fi + if (( $( wc -l "${log_file}" 2> /dev/null | cut -d ' ' -f 1 ) > 5 )) + then + echo "More than 5 changes have been detected on the bug tracker. Ignoring." >> "${changes}" + else + while read line < "${temp_changes}" + do + echo "${line}" >> "${changes}" + done + fi + mv "${temp_file}" "${log_file}" + rm -f "${temp_changes}" + sleep 5m done -- cgit v1.2.3-54-g00ecf