38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
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
|
|
################################################################################
|
|
|
|
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
# Load configuration
|
|
set -o allexport
|
|
source ${script_dir}/config/file_monitor
|
|
set +o allexport
|
|
|
|
# Import logging functionality
|
|
logfile=${script_dir}/log/file_monitor.log
|
|
log_identifier="FILE"
|
|
source ${script_dir}/functions/logging.sh
|
|
|
|
# Make sure directory exists
|
|
mkdir -p ${script_dir}/storage/file_monitor
|
|
|
|
for file in $FILES
|
|
do
|
|
# Touch storage file if not existing
|
|
if [ ! -f ${script_dir}/storage/file_monitor/${file//\//_} ]; then
|
|
touch ${script_dir}/storage/file_monitor/${file//\//_}
|
|
fi
|
|
|
|
if [ "$file" -nt "${script_dir}/storage/file_monitor/${file//\//_}" ]; then
|
|
log_echo "[CHANGE] $file"
|
|
touch ${script_dir}/storage/file_monitor/${file//\//_}
|
|
fi
|
|
done
|