mirror of
https://github.com/valitydev/inotify-tail.git
synced 2024-11-06 00:35:24 +00:00
295f1cd45f
Some checks failed
Build and publish Docker image / build-push (push) Has been cancelled
* mon script low cpu usage * fix path * rm intorify-utils
19 lines
346 B
Bash
Executable File
19 lines
346 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# directory to monitor
|
|
MONITOR_DIR=${1:-"/var/log/audit"}
|
|
|
|
process_file() {
|
|
local file="$1"
|
|
iconv -s -t utf-8 $file
|
|
rm -f "$file"
|
|
}
|
|
|
|
export -f process_file
|
|
|
|
while (true); do
|
|
find ${MONITOR_DIR} -type f -exec bash -c 'process_file "$0"' {} \;
|
|
find "${MONITOR_DIR}" -mindepth 1 -empty -mmin +2 -delete -type d
|
|
sleep 5
|
|
done
|