Skip to content

Commit

Permalink
Merge pull request metal3-io#548 from blallau/fix547
Browse files Browse the repository at this point in the history
🐛Fix CPU burning on ironic-log-watch when no ramdisk file is present
  • Loading branch information
metal3-io-bot committed Sep 16, 2024
2 parents 58be3ea + a519547 commit 7dfbbdf
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions scripts/runlogwatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
# Ramdisk logs path
LOG_DIR="/shared/log/ironic/deploy"

while :; do
if ! ls "${LOG_DIR}"/*.tar.gz 1> /dev/null 2>&1; then
continue
fi

for fn in "${LOG_DIR}"/*.tar.gz; do
echo "************ Contents of $fn ramdisk log file bundle **************"
tar -xOzvvf "$fn" | sed -e "s/^/$(basename "$fn"): /"
rm -f "$fn"
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

sleep 5
done

0 comments on commit 7dfbbdf

Please sign in to comment.