Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zjx20/xfswatch
A tool that run specified command whenever changes of target files was detected
https://github.com/zjx20/xfswatch
Last synced: 18 days ago
JSON representation
A tool that run specified command whenever changes of target files was detected
- Host: GitHub
- URL: https://github.com/zjx20/xfswatch
- Owner: zjx20
- License: mit
- Created: 2014-08-01T09:03:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-28T06:25:09.000Z (over 10 years ago)
- Last Synced: 2024-10-28T13:32:15.723Z (2 months ago)
- Language: Python
- Homepage:
- Size: 184 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
xfswatch
========A tool that run specified command whenever changes of target files was detected.
Install
-------```bash
sudo yum install libyaml libyaml-devel # for watchdog
sudo pip install watchdog
git clone https://github.com/zjx20/xfswatch.git
cd xfswatch
sudo python xfswatch.py --setup
```Usage
-----usage: xfswatch [-h] [--setup] --cmd CMD path [path ...]
positional arguments:
path path to be monitored, dir or fileoptional arguments:
-h, --help show this help message and exit
--setup link xfswatch.py to /usr/local/bin/xfswatch
--cmd CMD commandExamples
--------```bash
xfswatch ./dir1 ./dir2 --cmd "ls -al"xfswatch ./dir1 ./file1 ./file2 --cmd "echo foo"
xfswatch *.txt --cmd "cat *.txt"
# auto compile and run
xfswatch ./foo.h ./foo.cpp ./bar/def.h --cmd "make && ./t_foobar"
```Why xfswatch?
-------------There are many alternates of ```xfswatch``` such as [fswatch](https://github.com/alandipert/fswatch) and
[watchmedo](https://github.com/gorakhargosh/watchdog/blob/master/src/watchdog/watchmedo.py) in ```watchdog```.
Actually, ```xfswatch``` was inspired by ```fswatch```. I don't use ```fswatch``` because I can't compile it
on CentOS 6.5 with the default compiler toolchain. ```watchmedo``` is a wonderful tool that can be used to
take care of all tasks about file system monitoring. However, it was designed to watch for directories, so
it is not convenient enough for monitoring files (can be achieved by ```--pattern``` parameter anyway).