watcher
This commit is contained in:
@@ -101,5 +101,5 @@ find . -type f -name "*.md" -print0 | while IFS= read -r -d '' mdfile; do
|
|||||||
echo "$HTML_END"
|
echo "$HTML_END"
|
||||||
} > "$html_final"
|
} > "$html_final"
|
||||||
|
|
||||||
echo "Converted: $mdfile -> $html_final (+ .raw)"
|
echo "Converted: $mdfile"
|
||||||
done
|
done
|
||||||
|
|||||||
24
watch.sh
Executable file
24
watch.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
run_converter() {
|
||||||
|
bash ./convert-md.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
python3 -m http.server 8000 &
|
||||||
|
SERVER_PID=$!
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "Stopping server (PID: $SERVER_PID)..."
|
||||||
|
kill $SERVER_PID 2>/dev/null
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
trap cleanup SIGINT SIGTERM
|
||||||
|
|
||||||
|
run_converter
|
||||||
|
|
||||||
|
inotifywait -m -e modify -e create -e delete --include '\.md$' -r . 2>/dev/null | while read -r path event file; do
|
||||||
|
echo "Change detected: $event on $path$file"
|
||||||
|
run_converter
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user