1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
#
# Serve the docs locally with hot-reload at http://localhost:8000.
#
# Requires `zensical` — install with `pip install -r requirements.txt`
# in a venv, then re-run this script with that venv activated (or
# invoke ./.venv/bin/zensical directly).
#
# Common gotcha on Linux: Zensical's watcher consumes inotify
# instances. The kernel default (128 per user) runs out quickly on
# a dev machine with editors and file-syncers already open. If you
# see `Too many open files` / inotify panics, raise the cap:
#
# sudo sysctl fs.inotify.max_user_instances=512
#
# Persist it with:
#
# echo 'fs.inotify.max_user_instances=512' \
# | sudo tee /etc/sysctl.d/99-inotify.conf
# sudo sysctl --system
#
# Preflight: Zensical's watcher fails at inotify_init1 if the user's
# cap (fs.inotify.max_user_instances) is saturated by other running
# processes — typically VS Code, file syncers, etc. Count what's
# actually held and compare to the sysctl cap.
limit=
held=
if ; then
fi
# Non-fatal: getting close to the cap — warn but proceed.
if ; then
fi