git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/logrotchecker
blob: 4f16efecb36375f45be181bc40ece9f65cec4726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

# No way to push this to gitlab's CI runner YAML for now, so here's the script:
RETVAL=0

LOGROTS="$(find . -name "logrotate*" -type d|wc -l)"
[ "$LOGROTS" -eq 0 ]&&echo "No directory with a name starting with logrotate found."&&exit 0

for i in $(find . -name "logrotate*" -type d)/*;do
	ERRCNT="$(/usr/sbin/logrotate -ds /tmp/logrotcheck "$i" 2>&1|grep '^error:'|grep -vcE 'unknown group|found error')"
	echo "$i: $ERRCNT errors"
	[ "$ERRCNT" -ne 0 ]&&((++RETVAL))
	continue
done

exit $RETVAL