#!/bin/bash
# ************************************************************************
# * Flex-conf detectie en notificatie  Ben Makkink 24 juli 2020          *
# * Heeft bestand /usr/local/bin/flex-mail.txt nodig voor mail inhoud    *
# ************************************************************************

# check voor webserver update resulterend in nieuwe flex-{80,443}.conf's
if [ -f /etc/httpd/conf.d/flex-80.conf ]
 then
    # hernoem flex-{80,443}.conf's naar flex{80,443}.new zodat deze niet
    # geladen worden maar beschikbaar blijven voor integratie in
    # custom-httpd.conf
    mv /etc/httpd/conf.d/flex-80.conf /etc/httpd/conf.d/flex80.new;

    if [ -f /etc/httpd/conf.d/flex-443.conf ]
     then
        mv /etc/httpd/conf.d/flex-443.conf /etc/httpd/conf.d/flex443.new;
    fi
   
    # stuur notificatie naar de admin met de inhoud van flex-mail.txt
    /usr/sbin/sendmail ben@makkink.eu </usr/local/bin/flex-mail.txt
fi
