Univention Bugzilla – Bug 49399
Add Diagnostic check for tdb errors in sam.ldb.d/*
Last modified: 2019-06-26 17:42:52 CEST
We had a case, where the the /usr/sbin/univention-samba4-backup script called by the cron job /etc/cron.d/univention-samba4-backup aborted because the tdb-tools detected an error in one of the Samba ldb files. Like this: root@master:~# cd /var/lib/samba/private root@master:~# tdbbackup sam.ldb.d/DC=DOM,DC=INTRANET.ldb Failed to insert into sam.ldb.d/DC=DOM,DC=INTRANET.ldb.bak.tmp failed to copy sam.ldb.d/DC=DOM,DC=INTRANET.ldb The thing is: This went unnoticed for quite a while, because none of these error messages was logged. There was a /var/mail/systemmail file of about 50 MB and growing, but no message about the failure of the job. The tdbbackup script returns an exit code of 1 and outputs the messages to stderr. Additionally the /usr/sbin/univention-samba4-backup outputs echo "Error while backing up $file with tdbbackup - status $Status" to stdout. We should take some measure to improve the reporting in this case. Maybe a nagios job would be the right thing.
Created attachment 10058 [details] redirecting from stdout to stderror
echo .. exit 1 occurs several times, we should handle all of those, maybe die() { echo "$*" 1>&2 ; exit 1; } instead of echo "Error while backing up $file with tdbbackup - status $Status" exit 1
Created attachment 10081 [details] Refactor all error on exit in script This patch refactor so that all error message are redirected to stderror and exit the script. This also will send an system email per cron if such errors triggers.
OK, merge
Patch is merged and built in univention-samba4 ver. 8.0.0-25A~4.4.0.201906241403. 88e30756 :Bug #49399: redirect error message from tdbbackup to stderr so cron will email error 3c13a13c :Bug #49399: refactoring all exits on error 39b05bc2 :Bug #49399: Version bump dd780e41 :Bug #49399: yaml
OK
<http://errata.software-univention.de/ucs/4.4/162.html>