I looking for the way to mirror files on my server to others when something're updated and found that inotify is a good idea in this case.
Thanks for inotify-tools project, c library and set of command line programs for linux provide interface to inotify, that let me avoid from c code.
On ibex, i get it by..
Below is example shell script i use to moniter and update file to remote host.
for Java api look here
Thanks for inotify-tools project, c library and set of command line programs for linux provide interface to inotify, that let me avoid from c code.
On ibex, i get it by..
pnix@pnix-a7n:~$ sudo aptitude install inotify-tools
[sudo] password for pnix:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
inotify-tools libinotifytools0{a}
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 39.0kB of archives. After unpacking 201kB will be used.
Do you want to continue? [Y/n/?] y
...
Writing extended state information... Done
pnix@pnix-a7n:~$
Below is example shell script i use to moniter and update file to remote host
#!/bin/bash
while inotifywait -rq -e close_write /folder_to_moniter; do
rsync -av /folder_to_moniter -e "ssh -l pnix" pnix@remotehost:/home/pnix/tmp
done
for Java api look here
Comments
8-)