#!/bin/bash if sudo grep -q "'\[ERROR\]'" /var/lib/mysql/`hostname`.err; then echo "CRITICAL: There are errors in the error log!" exit 2; else echo "OK" fi