Questions tagged [fswatch]

A cross-platform file change monitor with multiple backends: Apple OS X File System Events API, *BSD kqueue, Linux inotify and a stat-based backend.

A cross-platform file change monitor with multiple backends: Apple OS X File System Events API, *BSD kqueue, Linux inotify and a stat-based backend.

http://emcrisostomo.github.io/fswatch/

54 questions
1
vote
1 answer

How to print file path that caused fswatch to do something

I use fswatch to take some actions when a file changes. I use the following command: fswatch -o -r '.' | while read MODFILE do echo 'Some file changed, so take some action' done this works fine, if I change a couple files I see the following in…
kramer65
  • 50,427
  • 120
  • 308
  • 488
1
vote
1 answer

Running a command after a command that used xargs and fswatch

Hi I am trying to write a shell command that does: watch a folder when a file has changed copy that new file somewhere then runs a make task fswatch ./src | xargs -I {} cp {} ./otherfolder the first 2 things are working with the command above,…
Nikki Koole
  • 136
  • 1
  • 8
1
vote
3 answers

Does inotifywait on Linux allow collection of events over a timeout period?

cf. FSEvents on OSX, which by default collects FS events over 1 second (timeout configurable) before firing off the event. This has the benefit of collecting a series of filesystem changes into a single event (so the script won't run more than it…
Steven Lu
  • 41,389
  • 58
  • 210
  • 364
0
votes
2 answers

How can I expand a Bash array as arguments to `fswatch`?

Here are the details of my setup. I have the following files: config.json { "paths": ["/Users/First Folder", "/Users/Second Folder"] } test.sh #!/bin/zsh monitored_paths=$(jq -r '.paths[]' config.json) fswatch --verbose…
F. Zer
  • 1,081
  • 7
  • 9
0
votes
0 answers

monitor fs via fswatch

dnf install epel-release dnf install fswatch I want to monitor all changes (create/modify/delete) under /blah/nav_prd and append all updates to /blah/itsbeenchanged I want to monitor all changes (create/modify/delete) under /blah/nav_prd and append…
visedawk
  • 11
  • 1
0
votes
0 answers

fswatch command fires multiple events for a single move operation

I have a photos.sh file (osascript set to JavaScript): #!/usr/bin/osascript -l JavaScript function run(argv) { return importFileIntoPhotos(argv[0]) }; // importFileIntoPhotos :: FilePath -> IO () const importFileIntoPhotos = fp => { const…
F. Zer
  • 1,081
  • 7
  • 9
0
votes
1 answer

Monitoring file changes in linux, Looking for a specific line

Assume a linux system with 4 instances of minicom opened and reading serial data input from 4 devices. Each minicom instance is saving the log into the corresponding text file. Serial data is received triggered by specific phisycal events and each…
mehdi
  • 167
  • 11
0
votes
0 answers

NodeJS Chokidar / fs issues with cloud object storage volumes mapped to docker container

I am using Chokidar package in my NodeJS code and having issues with watching folders that are created in Cloud Object Storage bucket and mounted as volumes in my Runtime. Same code is working flawlessly in my local Mac and also in on-prem linux…
JavaNaresh
  • 5
  • 1
  • 1
  • 4
0
votes
1 answer

How to effectively watch for large number of file changes?

I'm looking to write a daemon/service with the ability to effectively watch multiple files for changes and trigger an event when the file is written. The issue here is that for what I have in mind, I might be tracking potentially hundreds of files…
SSBakh
  • 1,487
  • 1
  • 14
  • 27
0
votes
1 answer

Git hook for unstaged changes/file changes

I'm looking to write a script that monitors all files/folders tracked by git to notify me if any of them have been changed. I'm looking for file changes and not necessarily staged changes. I've been combing through various SO questions and…
SSBakh
  • 1,487
  • 1
  • 14
  • 27
0
votes
1 answer

fswatch parsed argument not returning expected value?

I might misunderstand the xargs -I {} parsed argument of fswatch. This should return the file path of any new events in my specified directory, correct? My command below is intended to watch /my/path/to/watch and trigger my_script.py when a new…
Helen K.
  • 69
  • 7
0
votes
0 answers

fswatch not running script, reports as not found

I have a script in ~/bin called go_refresh. It's definitely there. I run fswatch like so: fswatch -o /usr/local/var/www/wp_sites/test/wp-content/themes/test/style.css | xargs -n1 -I{} ~/bin/go_refresh When I change the file, I get this error…
StevieD
  • 6,925
  • 2
  • 25
  • 45
0
votes
0 answers

Cannot find file when using fswatch and rsync to automatically sync directories

I am using fswatch and rsync to automatically sync directories between Mac and ubuntu servers. The shell is like /Users/david/Documents/code/shell/fswatch_rsync.sh: #!/bin/bash sudo fswatch -o /Users/david/Documents/code/python/ | xargs -n1…
david
  • 842
  • 2
  • 8
  • 25
0
votes
1 answer

fswatch error when trying to run react in a windows docker container

I'm running a unbuntu:latest docker container using Docker Toolbox on win10. I use create-react-app npm to automatically create a react app for me. when I run "npm start" I get the following error. events.js:182 throw er; // Unhandled 'error'…
roocell
  • 2,429
  • 25
  • 28
0
votes
1 answer

fswatch write then delete

I am using fswatch to refresh refreshed.txt when watched.txt is modified. Currently, something is appended to the refreshed.txt. fswatch -o watched.txt | xargs -n1 sh -c "echo 'something' >> refreshed.txt" However, I want to write something and…
Colin Ricardo
  • 16,488
  • 11
  • 47
  • 80