#!/bin/bash

if [ -f /etc/eole/samba4-vars.conf ]; then
    . /etc/eole/samba4-vars.conf
else
    . /var/lib/lxc/addc/rootfs/etc/eole/samba4-vars.conf
fi

if [ "$AD_TYPE" = "scribe" ]; then
    function CreoleRun () {
        lxc-attach -n addc -- $1
    }
fi

CreoleRun "samba-tool dbcheck" domaine | awk 'BEGIN{FS = "("}; /errors/ {gsub(")","",$0); print $2}' > /var/lib/eole/reports/samba-dbcheck.log

exit 0
