Java WatchService not generating events while watching mapped drives

后端 未结 5 1834
春和景丽
春和景丽 2020-11-30 05:58

I implemented a file watcher but I noticed that java nio file watcher doesn\'t generate events for files being copied on mapped drives. For instance, I\'ve run the file watc

5条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 06:14

    I had similar issues with a Python script watching content of a log file on a remote windows directory.

    Here is my answer.

    When mapping the remote drive from the Unix, in the /etc/fstab use //xxx.xxx.xxx.xxx/shareddrive /media/shareddrive cifs username=xxxx,password=xxxx,**directio** 0 0

    You can use a credentials file to avoid having the password in plain text.

    The command could change depending on the unix version, this was tested under debian. It should work as intended. Can you tell me if it works ? I plan on Implementing the same stuff in Java so the answer might be useful to me as well.

提交回复
热议问题