Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
thehunmonkgroup committed Jun 20, 2015
1 parent ef49344 commit f7fdf74
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions check_newest_file_age
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ OS_DISTRO=`uname -s`
for dir in $dirs
do
check_file=
let "DIR_COUNT += 1" > /dev/null
DIR_COUNT=$(($DIR_COUNT + 1))

# Check if dir exists.
full_path=${base_dir}${dir}
Expand Down Expand Up @@ -276,18 +276,18 @@ do
eval $(stat -s ${next_filepath})
fi

let "FILE_AGE = $CURRENT_TIME - $st_ctime" > /dev/null
let "FILE_AGE_UNITS = $FILE_AGE / $multiplier" > /dev/null
let "MAX_WARN_AGE = $warning * $multiplier" > /dev/null
let "MAX_CRIT_AGE = $critical * $multiplier" > /dev/null
FILE_AGE=$(($CURRENT_TIME - $st_ctime))
FILE_AGE_UNITS=$(($FILE_AGE / $multiplier))
MAX_WARN_AGE=$(($warning * $multiplier))
MAX_CRIT_AGE=$(($critical * $multiplier))
if [ $FILE_AGE -gt $MAX_CRIT_AGE ]; then
OUTPUT="$OUTPUT ${dir}: ${FILE_AGE_UNITS}${abbreviation}"
set_exit_status $STATE_CRITICAL
elif [ $FILE_AGE -gt $MAX_WARN_AGE ]; then
OUTPUT="$OUTPUT ${dir}: ${FILE_AGE_UNITS}${abbreviation}"
set_exit_status $STATE_WARNING
else
let "OK_FILE_COUNT += 1" > /dev/null
OK_FILE_COUNT=$(($OK_FILE_COUNT + 1))
if [ "$verbose" ]; then
OUTPUT="$OUTPUT ${dir}: ${FILE_AGE_UNITS}${abbreviation}"
fi
Expand All @@ -301,7 +301,7 @@ do
OUTPUT="$OUTPUT ${dir}: No files"
# If empty is an OK state, then increment the ok file count.
if [ "$on_empty" = "$STATE_OK" ]; then
let "OK_FILE_COUNT += 1" > /dev/null
OK_FILE_COUNT=$(($OK_FILE_COUNT + 1))
fi
fi
else
Expand Down

0 comments on commit f7fdf74

Please sign in to comment.