#!/bin/bash function printHelp { ( echo "$*" echo "" echo "Usage: $0 [-n] " echo "" echo " Filters the output of mksnapshot and filters it to show the results" echo " of the backup." echo "" echo "Options:" echo "-n: Disable tailing and exit as soon as the end of the file has been" echo " reached" echo "" ) 1>&2 exit 1 } tailopts="-f" while [[ $1 = -* ]] do case "$1" in -n) tailopts="" ;; *) printHelp "Unknown option '$1'" ;; esac shift done if [[ $# -ne 1 ]] then printHelp fi if [[ ! -r "$1" ]] then printHelp "Could not read '$1'" fi tail -n +0 $tailopts "$1" | grep -e '\*.*Backup.*starting' \ -e '\*.*Backup.*finished' \ -e '\*.*OK' \ -e '\*.*WARNING'