X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=epanic-clean;h=354d88b935e10d8b555710b637269e2136e5a0a6;hb=c5ef5441cb9193cbc9e27466945bf5daf72fce34;hp=a7220c2cf03267c2c2aacdd6822c172537d2d297;hpb=aa9cb10514e29340a6d6a194ee189fa4364f1f2e;p=distro-setup diff --git a/epanic-clean b/epanic-clean index a7220c2..354d88b 100755 --- a/epanic-clean +++ b/epanic-clean @@ -32,14 +32,22 @@ main() { return 0 fi + # example line: + # 2022-02-09 22:08:14.683 [59759] socket bind() to port 25 for address 10.8.0.28 failed: Cannot assign requested address: daemon abandoned + if [[ -e /etc/systemd/system/exim4.service.d/backup.conf ]]; then + regex="socket bind() to port 25 for address" + grep "$regex" $pl >> $pl-archive ||: + sed -i "/$regex/d" $pl + fi + # seems to randomly be caused by # Starting exim4-base housekeeping, exim4-base.service regex="^[^ ]* 00:00:0.* Failed writing transport results to pipe: Broken pipe$" grep "$regex" $pl >> $pl-archive ||: sed -i "/$regex/d" $pl - ## begin broken pipe ## - regex="Failed writing transport results to pipe: Broken pipe$" + ## begin broken pipe & write lock ## + regex="Failed to get write lock\|Failed writing transport results to pipe: Broken pipe$" now_s=$(date +%s) newlines=false count=0 @@ -51,17 +59,17 @@ main() { fi done < <(grep "$regex" $pl ||:) if (( count )); then - # i see these in groups of 3 for the same message around once a day + # I see broken pipe in groups of 3 for the same message around once a day # randomly. I'm guessing they are related to running 2 instances of # exim which share the same spool. So, if we have some, but not in # the last 5 minutes, and less than 20, it should be fine to clear - # them. + # them. write lock happens less but can fit under the same rule. if (( count > 20 )); then cat $pl - elif ! $newlines; then + elif ! $newlines; then grep "$regex" $pl >>$pl-archive sed -i "/$regex/d" $pl - fi + fi fi ## end broken pipe ##