check_no_matching_lines() {
info_check check_no_matching_lines "$@"
[ -f "$2" ] || return # no file, no problem
grep -q "$1" "$2" && warn "$2 has a line matching $1"
}
Example usage:
# Check that Jenkins jobs didn't install random crontabs
check_no_matching_lines ^[^#] /var/spool/cron/crontabs/jenkins
I've been using this on one server
Example usage: