ProgrammersOfVilnius / pov-check-health

Debian package that runs basic system health monitoring checks hourly from cron
https://launchpad.net/~pov/+archive/ppa
2 stars 0 forks source link

Wishlist: check_no_matching_lines #5

Closed mgedmin closed 5 years ago

mgedmin commented 9 years ago

I've been using this on one server

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