1
0
Files
Fanfiction/watch.sh
2026-05-12 20:00:01 +02:00

25 lines
465 B
Bash
Executable File

#!/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