Skip to content

Commit

Permalink
Merge pull request #484 from steveb/inotifywait
Browse files Browse the repository at this point in the history
Convert runlogwatch.sh to use inotifywait
  • Loading branch information
openshift-merge-bot[bot] authored Nov 28, 2024
2 parents 8a35c83 + 7f48f8d commit e49dd30
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions templates/common/bin/runlogwatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
# Ramdisk logs path
LOG_DIR=${LOG_DIR:-/var/lib/ironic/ramdisk-logs}

while :; do
sleep 5

while read -r fn; do
echo
echo "************ Contents of $fn ramdisk log file bundle **************"
tar -xOzvvf "$fn" | sed -e "s/^/$(basename "$fn"): /"
rm -f "$fn"
# find all *.tar.gz files which are older than six seconds
done < <(find "${LOG_DIR}" -mmin +0.1 -type f -name "*.tar.gz")

done
inotifywait -m "${LOG_DIR}" -e close_write |
while read -r path _action file; do
echo "************ Contents of ${path}${file} ramdisk log file bundle **************"
tar -xOzvvf "${path}${file}" | sed -e "s/^/${file}: /"
rm -f "${path}/${file}"
done

0 comments on commit e49dd30

Please sign in to comment.