#!/bin/bash
if [ $(CreoleGet activer_clam) = 'oui' ]; then
    . /usr/lib/eole/diagnose.sh
    EchoGras "*** Anti-virus"
    . /etc/eole/clamd-reload.cnf
    if [ -n "$CLAMD_CONTAINER" ];then
        IS_OK=0
        for container in $CLAMD_CONTAINER; do
            CreoleRun "/usr/bin/clamd-eole -p" $container &>/dev/null
            [ ! $? = 0 ] && IS_OK=1
        done
        printf ".  %${len_pf}s => " "Anti-virus"
        [ "$IS_OK" = "0" ] && EchoVert "Ok" || EchoRouge "Erreur"
    else
        Inactif "Anti-virus"
    fi
    #Vrai test ?
    TestPid "Service de maj" freshclam
    printf ".  %$((len_pf+1))s => " "Dernière maj"
    if [ -f /var/log/clamav/freshclam-status.log ];then
        . /var/log/clamav/freshclam-status.log
        if [ "$STATUS" = "" ]; then
            EchoOrange "Aucune information"
        else
            msg="(`date +%T' '%D -d @$DATE`)"
            [ "$STATUS" = "0" ] && EchoVert "Ok $msg" || EchoRouge "Erreur : $MSG $msg"
        fi
    else
        EchoOrange "Aucune information"
    fi
    echo
fi
