Skip to content

Scheduling

NetVuln Tool ships two ways to run scans on a recurring basis: a cron-backed wrapper (scheduled_scan.sh) plus a set of monitoring helpers, and a persistent scheduling daemon (netvuln_daemon.sh) that replaces cron entirely. The daemon is the recommended path for fleet deployments because it manages multiple configs, retries failures, and reports heartbeats back to the portal. For its internal architecture, see Daemon Mode.

Scheduled Scan

scripts/scheduled_scan.sh is an automated scan wrapper that reads a config file, runs the recon pipeline against its TARGETS, and optionally installs itself as a cron job.

scheduled_scan.sh -c <config.conf> [options]

Required:
  -c <file>         Report config file (must define TARGETS)

Options:
  --install-cron    Install a cron job using SCAN_SCHEDULE from the config
  --remove-cron     Remove the existing netvuln-tool cron job
  --daemon          Run in daemon mode (used internally by netvuln_daemon.sh)
  --dry-run         Show what would be executed without running
  -h, --help        Show help

The relevant config settings:

SettingDefaultPurpose
TARGETS(required)Comma-separated scan targets
SCAN_SCHEDULE0 2 * * 0 (Sunday 2am)Cron schedule expression
SCAN_PROFILEfull_reconScan profile to run
REPORT_VALIDITY_DAYS30Days before the report is considered expired
bash
# Run a scheduled scan once, now
./scripts/scheduled_scan.sh -c ~/netvuln-tool/configs/client.conf

# Install it as a weekly cron job (uses SCAN_SCHEDULE)
./scripts/scheduled_scan.sh -c ~/netvuln-tool/configs/client.conf --install-cron

# Preview the command without running
./scripts/scheduled_scan.sh -c ~/netvuln-tool/configs/client.conf --dry-run

The --daemon flag skips cron management and is used by the daemon when it owns the schedule itself.

Schedule Monitor

scripts/schedule_monitor.sh detects missed scheduled scans by comparing the expected cadence against the sessions on disk, and can raise alerts when a scan is overdue.

schedule_monitor.sh -c <config.conf> [options]

Required:
  -c <file>             Config file (must define TARGETS and SCAN_SCHEDULE)

Options:
  --alert               Send alert notifications for missed scans
  --dry-run             Show what would happen without sending alerts
  --json                Output results as JSON
  --tolerance <hours>   Hours of tolerance before marking a scan missed (default: 2)
  -h, --help            Show help

The exit code is 0 when the schedule is on track or unknown, and 2 when a missed scan is detected, which makes it convenient in cron or CI wrappers.

bash
# Alert if a scan is more than four hours overdue
./scripts/schedule_monitor.sh -c scan.conf --alert --tolerance 4

# Machine-readable status
./scripts/schedule_monitor.sh -c scan.conf --json

Schedule List

scripts/schedule_list.sh enumerates every registered scheduled-scan config and reports its cron status. It auto-discovers config files in ~/netvuln-tool/configs/*.conf.

schedule_list.sh [--json] [--configs-dir <dir>] [--no-cron-check] [-h]
FlagPurpose
--jsonOutput the list as a JSON array
--configs-dir <dir>Override the config directory (default ~/netvuln-tool/configs)
--no-cron-checkSkip crontab inspection (for hosts without cron)
bash
./scripts/schedule_list.sh
./scripts/schedule_list.sh --json
./scripts/schedule_list.sh --configs-dir /etc/netvuln/configs

Schedule Status

scripts/schedule_status.sh gives a combined health view across every discovered config, aggregating schedule_monitor results into one report.

schedule_status.sh [--json] [--alert] [--dry-run] [--configs-dir <dir>] [--tolerance <hours>] [-h]
FlagPurpose
--jsonOutput aggregate results as JSON
--alertSend alerts for any missed schedules
--dry-runShow which alerts would be sent without sending them
--configs-dir <dir>Override the config directory
--tolerance <hours>Override tolerance for all schedules (default per-config, else 2)
bash
./scripts/schedule_status.sh --json
./scripts/schedule_status.sh --alert --dry-run
./scripts/schedule_status.sh --configs-dir /etc/netvuln/configs --tolerance 4

Daemon Mode

scripts/netvuln_daemon.sh is a persistent scheduling daemon (v3.0.0) that replaces cron-based scheduling. It manages multiple configs, runs a built-in cron engine, retries failed scans with exponential backoff, and posts heartbeats to the portal.

netvuln_daemon.sh [--configs-dir <dir>] [--foreground] [-h]
FlagPurpose
--configs-dir <dir>Config directory (default ~/netvuln-tool/configs)
--foregroundRun in the foreground (the default; no self-daemonization)
-h, --helpShow help

A config is scheduled by the daemon only when it sets DAEMON_ENABLED="true". The daemon responds to signals so its lifecycle can be managed without a restart:

SignalEffect
SIGHUPReload all config files
SIGTERMGraceful shutdown (finishes the current scan)
SIGINTGraceful shutdown (finishes the current scan)
SIGUSR1Dump status to ~/netvuln-tool/logs/daemon_status.json

See Daemon Mode for heartbeats, system-info reporting, retry tuning, and the remote-override mechanism.

Daemon Control

scripts/netvuln_daemon_ctl.sh is the lifecycle CLI for the daemon, including optional systemd integration on Linux.

netvuln_daemon_ctl.sh <command> [options]
CommandAction
startStart the daemon in the background
stopStop the running daemon gracefully
restartStop and then start the daemon
reloadSend SIGHUP to reload configuration
statusShow daemon status and a schedule summary
install-serviceInstall the systemd service unit (Linux only)
uninstall-serviceRemove the systemd service unit (Linux only)

Any arguments after start or restart are forwarded to the daemon process, so you can point it at an alternate config directory.

bash
./scripts/netvuln_daemon_ctl.sh start
./scripts/netvuln_daemon_ctl.sh status
./scripts/netvuln_daemon_ctl.sh restart -c ~/netvuln-tool/configs/client.conf
./scripts/netvuln_daemon_ctl.sh install-service

Cron or daemon?

Use scheduled_scan.sh --install-cron for a single host with one or two schedules. Use the daemon when you run several configs, want automatic retries and portal heartbeats, or manage a fleet of agents through Command and Control.

Apache-2.0 licensed (appliance subtree proprietary)