0

I have a shell program that uses inotifywait to run some code every time a specific file is added to a directory. However, my code works for only a specific file name. The files that are added to the dir have a version in their name that changes frequently. Is there for inotifywait to catch like files added to the dir?

The files that are added dont have to stay in the dir (they are just added to trigger an inotify flag). I have thought about writing a code that triggers every time any file is added to the dir, but inotifywait seems to need the file already in the dir, and just flag every time the file is updated.

#!/usr/bin/bash
while inotifywait -e modify logfile.3.04.14.log; do

sleep 30 ##this is necessary for a background program 
###do something
done

do something is where three programs are called. What i have now works well if the file were to stay the same. Anyone have some advice?

KamilCuk
  • 120,984
  • 8
  • 59
  • 111

0 Answers0