X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=epanic-clean;h=c9739ba6d8474516e2c71fd1237f3665cb5527dc;hb=e801d1a57f0b30c57c6f644ab06a0f790159b236;hp=01755304a08de69fd8e5a5d0d245bc175e40565f;hpb=5abdcfce00c6ff61bf3856f7b5101915dc096107;p=distro-setup diff --git a/epanic-clean b/epanic-clean index 0175530..c9739ba 100755 --- a/epanic-clean +++ b/epanic-clean @@ -1,6 +1,25 @@ #!/bin/bash -# Copyright (C) 2019 Ian Kelling -# SPDX-License-Identifier: AGPL-3.0-or-later +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # The panic log regularly gets some stuff in it we dont want to fix. # Detect it and wipe it out. @@ -31,6 +50,11 @@ v() { fi } +spamd_ser=spamd +if systemctl cat spamassassin &>/dev/null; then + spamd_ser=spamassassin +fi + pl=/var/log/exim4/paniclog main() { @@ -89,7 +113,7 @@ main() { jmax="$(date -d @$sec_max "+%F %H:%M:%S")" description=$(systemctl cat $service | sed -rn 's/^ *Description=(.*)/\1/p') jrregex="^Starting $description" - if [[ $service == spamassassin ]]; then + if [[ $service == "$spamd_ser" ]]; then jrregex+="\|^spamd: restarting" fi d "jrregex=$jrregex jmin=$jmin jmax=$jmax" @@ -110,9 +134,9 @@ main() { sed -ri "/$regex/d" $pl fi fi - done <<'EOF' + done <