0

How could I trigger a command in ubuntu/linux, whenever a new file is created in a directory by a Java webapp ?

Usage/Context: I need to move a newly created file (created by java app), in a directory to amazon s3 using s3cmd command.

Rajat Gupta
  • 23,343
  • 56
  • 165
  • 281
  • 1
    You need to use Directory watcher. Here is a link to tutorial: http://java.dzone.com/news/how-watch-file-system-changes – Sudarshan_SMD Feb 22 '14 at 10:37
  • I think I would need this watcher at the linux end instead of, at java end. In fact java itself is responsible for/ making those changes. – Rajat Gupta Feb 22 '14 at 10:53
  • 1
    hmm...So, looks like you have to work with shell scripting. Look if following link helps: http://stackoverflow.com/questions/4060212/in-linux-how-do-i-run-a-shell-script-when-a-file-or-directory-changes – Sudarshan_SMD Feb 22 '14 at 11:09
  • Thanks @Sudarshan_SMD! – Rajat Gupta Feb 24 '14 at 05:03

0 Answers0