diff options
author | Joe <joe@joelightning.com> | 2011-12-12 11:38:07 +0000 |
---|---|---|
committer | Joe <joe@joelightning.com> | 2011-12-12 11:38:07 +0000 |
commit | 8ef6a0a4360f7ce92575f83897e775b690e0ac7a (patch) | |
tree | 0f3523c9de676fc6c8e6788517cb346a568265b7 | |
parent | 0fc8ed718f863c0fce10d166e926d3631033fd80 (diff) |
If too many changes are detected it will ignore.
-rwxr-xr-x | bug_tracker_change_detector | 18 |
1 files changed, 16 insertions, 2 deletions
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" - '%<title>%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 |