#!/bin/bash STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 STATE_DEPENDENT=4 HOME_RANCID=/home/rancid DAY=$(date +"%d") YESTERDAY=$(echo "$DAY - 1" | bc -l) MONTH=$(date +"%m") YEAR=$(date +"%Y") if test $# -eq 2 then ECHO="Parameter correct else ECHO="Parameter unknown" exit 1 fi test -e $HOME_RANCID/var/rancid/$1/configs/$2 >>/dev/null if [ $? = 0 ]; then BACKUPFILE_DAY=$(ls -la $HOME_RANCID/var/rancid/$1/configs/$2 | cut -d " " -f 7 ) else echo -e no Backup-File found exit 3 fi if [ $BACKUPFILE_DAY -lt $YESTERDAY ]; then echo $YESTERDAY Uups - Take a look! Backupfile is old - Maybe Backup is not running exit 1 fi LOGS=$( cat $HOME_RANCID/var/rancid/logs/$1.$YEAR$MONTH$BACKUPFILE_DAY.* | grep $2 ) if [ "$LOGS" == "" ]; then echo Nice - Backup is running but no changes found exit 0 else echo Nice - Backup is running - Rancid found some changes exit 0 fi