X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=epanic-clean;h=4f365fda5aaf907dc66e69323166b0412c46fc72;hb=7e673f2615101982a17ffa0e23cb10b5b3803f07;hp=8c26855041437f27fb4de093a5432ec64d4739d7;hpb=12cab163424e3a7b0815646d1d4407f9b5839bcb;p=distro-setup diff --git a/epanic-clean b/epanic-clean index 8c26855..4f365fd 100755 --- a/epanic-clean +++ b/epanic-clean @@ -32,6 +32,18 @@ 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 + + # this is a strange message due to running as nonroot + # regex='exim user lost privilege for using -C option' + # sed -i "/$regex/d" $pl + # 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$" @@ -58,10 +70,10 @@ main() { # 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 ## @@ -114,12 +126,15 @@ spamassassin spam acl condition EOF } -if [[ $INVOCATION_ID ]]; then - # this is to prevent systemd from filling up the journal - for (( runcount=0; runcount < 100; runcount++ )); do +loop-main() { + while true; do main sleep 30 done +} + +if [[ $INVOCATION_ID ]]; then + loop-main else main fi