36 lines
1007 B
Bash
Executable File
36 lines
1007 B
Bash
Executable File
#!/bin/bash
|
|
|
|
################################################################################
|
|
# FILE_MONITOR.SH
|
|
# ---------------
|
|
# This script checks the docker health and reports any problems on stdout
|
|
#
|
|
# Author: Robin Meier - robin@meier.si
|
|
################################################################################
|
|
|
|
# Load configuration
|
|
set -o allexport
|
|
source /root/scripts/config/file_monitor
|
|
set +o allexport
|
|
|
|
# Import logging functionality
|
|
logfile=/root/scripts/log/file_monitor.log
|
|
log_identifier="FILE"
|
|
source /root/scripts/functions/logging.sh
|
|
|
|
# Make sure directory exists
|
|
mkdir -p /root/scripts/storage/file_monitor
|
|
|
|
for file in $FILES
|
|
do
|
|
# Touch storage file if not existing
|
|
if [ ! -f /root/scripts/storage/file_monitor/${file//\//_} ]; then
|
|
touch /root/scripts/storage/file_monitor/${file//\//_}
|
|
fi
|
|
|
|
if [ "$file" -nt "/root/scripts/storage/file_monitor/${file//\//_}" ]; then
|
|
log_echo "[CHANGE] $file"
|
|
touch /root/scripts/storage/file_monitor/${file//\//_}
|
|
fi
|
|
done
|