[Technik] Aus Support: spamd-Problem

Christof Thalhofer chrisml at deganius.de
Thu Jun 26 16:49:43 CEST 2008


Christof Thalhofer schrieb:

...

Sorry für den blöden Zeilenumbruch, das kam wohl vom Pasten:
Es sollte so heissen:

/usr/local/bin/restartdaemons:

<schnipp
 #! /bin/bash

 conf=/etc/example.com/restartdaemons

 for such in $(cat $conf | grep -v "#" | grep -v ^$ | sed s/"\s.*"//)

 do

     line=$(grep $such $conf)
     ergebnis=$(ps -ef | grep -v grep | grep -c $such)

     #zum debuggen
     #echo suche $such : ergebnis: $ergebnis

     if [ $ergebnis -eq 0 ]
     then
        startcmd=$(echo $line | awk '{print $2}')
        logger $startcmd musste neu gestartet werden
        /etc/init.d/$startcmd restart
        echo $startcmd musste auf $(hostname -f) neu gestartet werden | \
        mailx -s "Neustart auf $(hostname)" hostmaster at example.com
     fi
 done

<schnapp

In /etc/example.com/restartdaemons stehen alle Daemons, die überwacht
werden müssen mit ihren Startbefehlen:

<schnipp

 #Diese daemons werden, wenn sie in der
 #prozessliste nicht gefunden werden,
 #automatisch per cron neu
 #gestartet
 #

 #suchbegriff    (/etc/init.d)neustartbefehl

 spamd           spamassassin
 pop3d-ssl       courier-pop-ssl
 authdaemond     courier-authdaemon
 sshd            ssh
 postfix         postfix
 saslauthd       saslauthd
 clamav          clamav-daemon
 fail2ban-server fail2ban

<schnapp


Alles Gute

Christof Thalhofer
-- 





More information about the Technik mailing list