Configuration
File Watching
Auto-restart processes when source files change.
pm3 can watch your source files and automatically restart a process when changes are detected — perfect for development workflows.
Configuration
Watch the Working Directory
[web]
command = "node server.js"
watch = trueWhen watch = true, pm3 watches the process's working directory (cwd, or the directory containing pm3.toml).
Watch a Specific Path
[web]
command = "node server.js"
watch = "./src"You can specify a relative path to watch only a subdirectory.
Ignore Patterns
[web]
command = "node server.js"
watch = "./src"
watch_ignore = ["node_modules", ".git", "dist", "*.log"]Debounce Duration
[web]
command = "node server.js"
watch = "./src"
watch_debounce = 1000Type: integer (milliseconds) | Default: 500
Controls how long pm3 waits after detecting a file change before triggering a restart. Increase this if rapid successive saves cause too many restarts.
Type: array of strings
Patterns in watch_ignore are matched against directory names and path suffixes. Common patterns to ignore:
"node_modules"— Node.js dependencies".git"— Git internals"dist"or"build"— build output"*.log"— log files
Behavior
- Debounce: File change events are debounced (default: 500ms, configurable via
watch_debounce). Multiple rapid changes trigger only one restart. - Restart: When a change is detected, pm3 performs a graceful restart of the process (sends
kill_signal, waitskill_timeout, then respawns). - Restart counter: File-watch restarts do not count toward
max_restarts.
Example
[frontend]
command = "npm run dev"
cwd = "./frontend"
watch = "./src"
watch_ignore = ["node_modules", ".git"]
watch_debounce = 1000
[api]
command = "cargo run"
cwd = "./api"
watch = "./src"