0

Is it possible to create some kind of directory watcher and trigger a script when the folder is not empty?

I have a CentOS machine with jenkins CI on it. i would like to create a job that will move all build artifacts to my web server folder each successful build. is it possible?

I want to avoid timed triggered cronjob.

Ori Price
  • 207
  • 3
  • 8
  • `watch` is what you need. – Ramesh May 10 '14 at 19:20
  • did you try [inotify](http://inotify.aiken.cz/?section=inotify&page=why&lang=en)? See [similar question in stackoverflow](http://stackoverflow.com/questions/4060212/in-linux-how-do-i-run-a-shell-script-when-a-file-or-directory-changes). – carandraug May 10 '14 at 19:22
  • thanks, watch is not what i am looking for... i think inotify will do. – Ori Price May 10 '14 at 19:41

1 Answers1

0

Use inotifywait it can monitor a directory, check this answer.

X Tian
  • 10,413
  • 2
  • 33
  • 48