File monitor: Difference between revisions
Jump to navigation
Jump to search
| (One intermediate revision by the same user not shown) | |||
| Line 8: | Line 8: | ||
==Requirements== |
==Requirements== |
||
* Must support cancelable shell command. |
|||
* Functions/GoRoutines can't be canceled. |
|||
* Different editors have differnt save strategies. |
|||
* Most changes result in multiple events (touch for example CREAT+CHMOD). |
|||
* Should support a delay (could stop spamming changes). |
|||
* Delay should be reset each time a new action occurs. |
|||
Modification time? Might not help if you copy an old file onto a new one... |
Modification time? Might not help if you copy an old file onto a new one... |
||
==Example== |
|||
file: /usr/lib/modules/linux.so |
|||
cancelable: yes |
|||
delay: 10ms |
|||
action: cp /usr/lib/modules/linux.so /boot/efi/blah.so |
|||
file: /src/program |
|||
cancelable: yes |
|||
delay: 10ms |
|||
action: go test ./... |
|||
file: /mnt/storage/large_files |
|||
cancelable: no |
|||
delay: 10ms |
|||
action: go func {SomeLongRunningAction()} |
|||
==fsnotify event examples== |
==fsnotify event examples== |
||
Latest revision as of 00:15, 10 April 2016
Simplified File Watching Interface[edit | edit source]
Use cases[edit | edit source]
- Watch for source code changes and rerun unit tests
- Shell command, should be cancelable
- Needs to be filterable (ie .go, .cpp, .hpp)
- Watch for kernel/nvidia driver changes and copy to EFI
Requirements[edit | edit source]
- Must support cancelable shell command.
- Functions/GoRoutines can't be canceled.
- Different editors have differnt save strategies.
- Most changes result in multiple events (touch for example CREAT+CHMOD).
- Should support a delay (could stop spamming changes).
- Delay should be reset each time a new action occurs.
Modification time? Might not help if you copy an old file onto a new one...
Example[edit | edit source]
file: /usr/lib/modules/linux.so cancelable: yes delay: 10ms action: cp /usr/lib/modules/linux.so /boot/efi/blah.so
file: /src/program cancelable: yes delay: 10ms action: go test ./...
file: /mnt/storage/large_files
cancelable: no
delay: 10ms
action: go func {SomeLongRunningAction()}
fsnotify event examples[edit | edit source]
touch a[edit | edit source]
2016/04/09 11:59:47 Event: "/home/hegemon/programming/ansible/a": CREATE 2016/04/09 11:59:47 Event: "/home/hegemon/programming/ansible/a": CHMOD
vim :wq[edit | edit source]
2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/4913": CREATE 2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": RENAME 2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": CREATE 2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": WRITE 2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": CHMOD
atom (save existing file):[edit | edit source]
2016/04/09 13:32:59 Event: "/home/hegemon/programming/ansible/a": WRITE 2016/04/09 13:32:59 Event: "/home/hegemon/programming/ansible/a": WRITE
mv b a[edit | edit source]
2016/04/09 13:31:24 Event: "/home/hegemon/programming/ansible/b": RENAME 2016/04/09 13:31:24 Event: "/home/hegemon/programming/ansible/a": CREATE