Skip to content

Scheduling and process management

7 min readRecon Atlas

A scheduler that overlaps runs or hangs overnight costs you the whole night. Pick one scheduler and use it for everything. Wrap every stage in flock so runs never overlap and in timeout so one hung tool cannot eat the night. Log to one run log plus one error file per stage, use a fixed exit code convention, and run cheap stages often and expensive ones rarely.


cron systemd timer tmux with a sleep loop
What it is The classic Unix scheduler, one line per job A .timer unit that starts a .service unit A terminal session that never closes, running while true; do ...; sleep 3600; done
Setup effort Lowest Medium: two small files Lowest
Survives reboot Yes Yes No
Missed runs after downtime Skipped Can catch up with Persistent=true Not applicable
Logs Whatever you redirect journalctl, plus your own files Scrollback, lost on crash
Resource limits None built in CPUQuota, MemoryMax, TimeoutStartSec in the unit None
Random delay to avoid the top of the hour Pick an odd minute by hand RandomizedDelaySec By hand
Best for One or two simple jobs, the recon monitoring setup An always-on pipeline you depend on Watching a first run live while you debug it

My recommendation: tmux while you build and debug, then systemd timers for anything that runs unattended. Cron is fine if you already know it and run only a couple of jobs. The criteria are survival across reboots, built-in resource limits, and logs you can query; the trade-off is two extra files per job.

# crontab -e: run the pipeline daily at 02:17 UTC and the digest at 07:43
CRON_TZ=UTC
17 2 * * * PROGRAM=example /home/hunter/pipeline/bin/auto-triage.sh >>/home/hunter/pipeline/cron.log 2>&1
43 7 * * * PROGRAM=example /home/hunter/pipeline/bin/auto-triage.sh digest >>/home/hunter/pipeline/cron.log 2>&1

CRON_TZ is supported by cronie and some other cron implementations, not all. If yours ignores it, set the server clock to UTC. Check man 5 crontab on your box.

If the 02:17 run is still going at 03:17 when the next one starts, two copies write into the same state files and send the same traffic twice. A lock prevents that: only one holder at a time.

flock (part of util-linux, present on Debian and Ubuntu) takes a lock on a file. With -n it gives up immediately instead of waiting.

Terminal window
# Inside a script: hold a lock on file descriptor 9 for the whole run, or exit with code 5
exec 9>"$P/state/.lock"; flock -n 9 || { echo "another run holds the lock" >&2; exit 5; }
Terminal window
# From cron or a shell, wrap any single stage without editing it
flock -n ~/pipeline/programs/example/state/.probe.lock timeout 40m httpx -l resolved.txt -rl 10 -silent -j -o httpx.json

The lock is released automatically when the process exits, including a crash. That is the advantage over “touch a .lock file and delete it at the end”: a crashed script leaves a stale lockfile behind and every future run refuses to start.

Lock choice Effect
One lock per program Two programs can run in parallel, one program never runs twice. The worked pipeline does this
One lock per stage Hourly probing and daily enumeration can overlap safely, but each stage never overlaps itself
One global lock Simplest, and the safest on a small VPS. Nothing runs in parallel

A hung tool is the most common way an unattended night produces nothing. A DNS resolver that stops answering, a host that drips one byte a minute, a headless browser that waits forever. timeout (GNU coreutils) kills a command after a time limit.

Terminal window
# Give the probe stage 40 minutes, then send TERM; if still alive 30 seconds later, send KILL
timeout -k 30 40m httpx -l resolved.txt -rl 10 -silent -j -o httpx.json
Exit code from timeout Meaning What the pipeline should do
The command’s own code Finished inside the limit Normal handling
124 Time limit hit, command was sent TERM Log a warning, keep the partial output, continue to the next stage if it can use partial input
125 timeout itself failed Treat as a stage failure
126 Command found but could not run Stage failure: check permissions
127 Command not found Stage failure: check PATH, a classic cron problem
137 Killed with KILL (128 plus 9), after -k Log it; the tool ignored TERM

Choose limits from real runs, not guesses: run each stage by hand on your biggest program, note the time, and set the limit at two to three times that. Revisit when scope grows.

One convention, used everywhere, so a tired person at 7 AM can read it.

  • One run log per run, runs/<stamp>/run.log. One line per event, UTC timestamp first, a level word (WARN, FATAL) when it is not routine.
  • One error file per stage, runs/<stamp>/logs/<stage>.err, holding that tool’s stderr. The run log says “probe exited 1, see logs/probe.err” and you open one file.
  • The scheduler’s own log (cron.log or journalctl) catches anything that happened before the script could open its run log, such as a missing interpreter.
# Example run.log
[2026-11-13T02:17:04Z] start program=example rate=10 run=/home/hunter/pipeline/programs/example/runs/2026-11-13T021704Z
[2026-11-13T02:21:40Z] enum: 1412 in-scope hosts, 6 new
[2026-11-13T02:58:12Z] WARN probe timed out after 2400s
[2026-11-13T02:58:12Z] probe: 611 live in-scope URLs
[2026-11-13T03:40:55Z] dedup: 37 raw, 2 new
[2026-11-13T03:42:01Z] done: 2 new findings, queue at .../queue.tsv
Exit code Meaning in this pipeline
0 Run completed. It may have found nothing; that is still success
2 Usage error: no PROGRAM, unknown mode
3 Fail closed: scope, policy or config missing or invalid. Nothing was sent
4 A required tool is missing from PATH
5 Another run holds the lock. Normal if runs are long; a problem if it happens every time
6 A required stage failed or produced nothing usable
124, 137 Passed through from timeout when a stage was killed

Health checks in Part 9 alert on anything other than 0 and 5.

Not every stage needs the same cadence. Match cadence to how fast the thing changes and how much noise the stage makes.

Cadence Stages Noise Why
Hourly Re-probe the top of the queue and new-hosts.txt only Light active Catch a new deploy within the hour, on a handful of hosts
Daily Passive enumeration, resolution, full probe, scoring, filtered Nuclei on the top N Passive to Heavy active Most programs change on a scale of days
Daily Digest send None to the target One message a morning
Weekly Deep passes: screenshots of everything, port scans of origin IPs, wider Nuclei tags, CVE feed refresh Heavy active Expensive and slow-changing
Weekly Tuning review (by you, Part 9) None Weights drift out of date

Give each cadence its own timer or crontab line, and its own lock if they can overlap. Stagger start times across programs so you never run three heavy stages at once.

The dedicated VPS is the right home: always on, a datacenter IP you can name in a report, and a provider whose acceptable use policy you have read. Run the pipeline as an ordinary user, not root.

Directly on the VPS In a container
Setup pdtm and go install, as in the setup guide A Dockerfile that installs the same tools
Reproducibility Drifts as you update tools by hand Rebuild gives the same toolset every time
Debugging Simple One more layer between you and the tool
Raw sockets for port scans Works Needs extra capabilities
Best for One VPS, one hunter, the first year Moving between machines, or a fleet

For most hunters, run directly on the VPS and pin tool versions in a notes file. Containerize when you move to a second machine.

A rough budget on a 2 vCPU, 4 GB RAM VPS, the recommended starter size. All figures approximate; they depend on target response times, rate limits and tool versions.

Stage Size Approximate time Approximate memory Limiter
Passive enumeration 20 roots 5 to 20 min Under 500 MB API rate limits of data sources
Resolution 20,000 names 2 to 10 min Under 500 MB Resolver quality
HTTP probe 2,000 hosts at 10 req/s 5 to 15 min Under 1 GB Your rate limit, by design
Screenshots 300 hosts 15 to 45 min 1 to 2 GB at 4 to 5 parallel browsers Headless Chrome memory
Nuclei, filtered tags 300 URLs at 10 req/s 30 to 90 min 1 to 2 GB Rate limit times template count

Screenshots are where small boxes fall over. Each headless browser can take a few hundred MB, so keep screenshot concurrency at 4 or 5 on 4 GB, and run screenshots weekly or only on new hosts. Add swap as a safety net, not as capacity.

Cron and a tmux loop can leave headless Chrome children holding RAM after the stage dies. A systemd service runs in a cgroup, and stopping the unit kills those children too.

Terminal window
# Check disk, memory and the biggest folders before you schedule anything heavy
df -h ~ && free -h && du -sh ~/pipeline/programs/*/{runs,evidence} 2>/dev/null | sort -h | tail

Next, keep every stage inside the program’s rules with Scope enforcement as code.

Connections3 backlinks · 4 outgoingFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Recon AtlasFor authorized testing only. Your scope is the map edge.