summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Graham <joseph@xylon.me.uk>2017-05-29 12:09:15 +0100
committerJoseph Graham <joseph@xylon.me.uk>2017-05-29 12:09:15 +0100
commite1c4ef87e665a1a8476e063f03797f4e0496ac8b (patch)
tree69b4af717fca7afe672f2bb2b277019ede19b348
parent4cd9d79557331074d4d469679b21266a9cf81039 (diff)
Tweak to not keep file open for writing for days on end. Hope it might
stop pbot from stopping to report bug tracker changes.
-rwxr-xr-xlabs_change_detector54
1 files changed, 29 insertions, 25 deletions
diff --git a/labs_change_detector b/labs_change_detector
index 50b0753..1c0db34 100755
--- a/labs_change_detector
+++ b/labs_change_detector
@@ -14,30 +14,34 @@ shopt -s extglob
next_line_is_url=0
inotifywait -m --format '%w%f' -e create "${maildir}" 2>/dev/null |
-while read email
-do
- while read line
+ while read email
do
- case "${line}" in
- 'Subject: ['* )
- lp1="${line#Subject: [}"
- lp="${lp1%% - *}"
- echo -n "${lp}"
- ;;
- 'Issue #'* )
- echo -n " - ${line}"
- ;;
- *' #'+([[:digit:]])': '* )
- echo -n " (${line#'Bug #'+([[:digit:]])': '})"
- next_line_is_url=1
- ;;
- 'https://labs.parabola.nu/issues/'* )
- (( next_line_is_url )) &&
- echo -n " ${line}"
- break
- ;;
- esac
- done < "${email}"
+ while read line
+ do
+ case "${line}" in
+ 'Subject: ['* )
+ lp1="${line#Subject: [}"
+ lp="${lp1%% - *}"
+ echo -n "${lp}"
+ ;;
+ 'Issue #'* )
+ echo -n " - ${line}"
+ ;;
+ *' #'+([[:digit:]])': '* )
+ echo -n " (${line#'Bug #'+([[:digit:]])': '})"
+ next_line_is_url=1
+ ;;
+ 'https://labs.parabola.nu/issues/'* )
+ (( next_line_is_url )) &&
+ echo -n " ${line}"
+ break
+ ;;
+ esac
+ done < "${email}"
- echo
-done >> "${bot_ipc}"
+ echo
+ done |
+ while read message
+ do
+ echo "${message}" >> "${bot_ipc}"
+ done