Initial poop
This commit is contained in:
commit
ca6dab46f1
3280 changed files with 3759 additions and 0 deletions
18
docs/programming/watchdir.md
Normal file
18
docs/programming/watchdir.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Watch directory for changes
|
||||
|
||||
Watching directory for changes can be useful for example let's say you have a markdown based knowledgebase and want to automagically rebuild statically served html-site. Like this one right here!
|
||||
|
||||
## Script
|
||||
|
||||
Use #bash and make a fancy scriptie using `inotify-tools`. This can be installed from debian repos using `sudo apt install inotify-tools`. For example this #mkdocs site uses following at the time of writing:
|
||||
|
||||
``` sh
|
||||
#!/bin/sh
|
||||
. bin/activate
|
||||
while true
|
||||
do
|
||||
mkdocs build
|
||||
inotifywait -r dokut
|
||||
done
|
||||
```
|
||||
Main takes here are the infinite loop that rebuilds docs and then waits for any change in directory (recursively) before looping again. Here would also be a good place to setup some `sleep`ing to ratelimit things or a more complex script to even wait no more changes are detected for some time...
|
Loading…
Add table
Add a link
Reference in a new issue