dimanche 8 mars 2015

Using inotifywait along with vim


I have simple script that monitors file for changes and rsyncs it with remote copy:



#!/bin/bash

while inotifywait -e close_write somefile
do
rsync somefile user@host.domain:./somefile
done


It works just fine with nano, but fails with vim. When i use nano, it outputs :



somefile CLOSE_WRITE,CLOSE


and starts next loop waiting for another edition.


When i use vim, there is no output, script just closes with exit code 0.


I did some research and found out that close_write is right parameter for uing initofywait along with vim (first i wanted to use modify event), yet for some reason it fails for me.



Aucun commentaire:

Enregistrer un commentaire