devilbox / watcherd Goto Github PK
View Code? Open in Web Editor NEWA shell daemon that will listen for directory changes and execute custom commands for each event.
Home Page: http://devilbox.org
License: MIT License
A shell daemon that will listen for directory changes and execute custom commands for each event.
Home Page: http://devilbox.org
License: MIT License
I am using devilbox to run 15 local sites for development, and some of those sites have lots of little files (user uploads).
Whenever this script runs, I can hear my CPU fan spin up and down constantly as this script traverses every single directory and sub-directory.
Using the time
command, it says it takes almost 2s for the find command to run. I have 807983 files and folders, at least that's the number I get back by counting the number of lines returned from the find command.
I would like to propose a change for the find command to use the -maxdepth 1
option so that it doesn't have to uselessly traverse every single sub-directly since we really only care about the direct folders underneath the /shared/httpd directory (specifically in devilbox). Using the maxdepth option reduces the time it takes to run the command down to just 0.022s which is a significant savings, and could also reduce the amount of disk I/O required as well.
I kind of suspect this script could reduce the lifespan of an SSD because of how much it is looping through all of my files and folders, every few seconds for 8+ hours a day.
And if we really want to optimize, we could also pass the -type d
option so the find command only gets folders only instead of both files and folders by default. This could also replace the need for the two grep statements possibly since those seem like there really only used for getting the base folders from what I understand.
I can make a PR if you would like to implement this change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.