out of swap space(その13:process監視にfail2banを追加)

fail2banがout of swap spaceで落ちていました。
process監視に追加するのを忘れていたため、その10の最後にfail2banを追加しました。

#!/bin/sh
#
# $Id: start_proc,v 1.2 2020/08/10 00:27:12 ishizuka Exp ishizuka $
#

sec=$1
t0=`date -j "+%s"`

if [ -z $sec ]; then
  sec=300
fi

for proc in devd local_unbound syslogd ntpd sshd sendmail cron blacklistd; do
  /etc/rc.d/$proc status 1>/dev/null || /etc/rc.d/$proc start
done

for proc in saslauthd nsd mysql-server dovecot apache24 milter-greylist \
  php-fpm; do
  /usr/local/etc/rc.d/$proc status 1>/dev/null \
    || /usr/local/etc/rc.d/$proc start
done

for datetime in `/usr/bin/sed -n 's/\(...............\).*: Milter (greylist): to error state/\1/p' /var/log/maillog | sed 's/ /0/g'`; do
  t=`/bin/date -j -f "%b0%d0%T" $datetime "+%s"`
  if  [ $(($t0 - $t)) -le $sec ]; then
    /usr/local/etc/rc.d/milter-greylist restart
    break
  fi
done

for proc in fail2ban; do
  /usr/local/etc/rc.d/$proc status 1>/dev/null \
    || (rm -f /var/run/$proc/$proc.sock; /usr/local/etc/rc.d/$proc start)
done

その12へ戻る