0

I need to listen a directory, I can listen if a file is created in this directory and it works

inotifywait -m -r -e moved_to -e create "$DIR" --format "%f" | while read f 
do
        if [[ $f = *.csv ]] ; then
                do something
        fi

done

But, if this file not created, I need to send emails at 12:00 and 19:00 (at 19:00) I need to kill the process.

So, how can I monitor file and system time using inotifywait? I tried using double conditions in while, but doesn't work

Neil John
  • 37
  • 9

1 Answers1

0

Use incrontab(5) with incrond(8). Of course you should install it and combine with test(1).

My opinion is that scripting languages like Guile, Python, Lua are better suited for such tasks. You'll find extensions to them related to inotify(7).

I need to send emails at 12:00 and 19:00 (at 19:00)

That is more a job for crontab(5)

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547