Skip to content

watchdog

The watchdog command group manages automatic synchronization using your platform’s native scheduler.

The watchdog:

  • Runs config push every 2 minutes
  • Uses platform-native schedulers (launchd, cron, Task Scheduler)
  • Restores itself if removed
  • Can be temporarily disabled
SubcommandDescription
statusCheck scheduler status
installCreate scheduled sync jobs
uninstallRemove scheduled jobs
enableRe-enable after disable
disableTemporarily disable

Check if the watchdog is running and view its status.

Terminal window
nextdns-blocker watchdog status
Watchdog Status
━━━━━━━━━━━━━━━
Platform: macOS (launchd)
Status: Active ✓
Jobs:
NextDNS-Blocker-Sync
Schedule: Every 2 minutes
Last run: 2024-01-15 14:28:00
Next run: 2024-01-15 14:30:00
NextDNS-Blocker-Watchdog
Schedule: Every 5 minutes
Purpose: Ensures sync job exists
StatusMeaning
ActiveJobs are scheduled and running
InactiveJobs not installed
DisabledTemporarily disabled by user
ErrorJobs exist but have issues

Create the scheduled synchronization jobs.

Terminal window
nextdns-blocker watchdog install
Installing watchdog jobs...
Platform: macOS (launchd)
Creating jobs:
✓ NextDNS-Blocker-Sync (every 2 minutes)
✓ NextDNS-Blocker-Watchdog (every 5 minutes)
Jobs installed successfully
Location: ~/Library/LaunchAgents/
Run 'watchdog status' to verify
PlatformSchedulerLocation
macOSlaunchd~/Library/LaunchAgents/
Linuxcroncrontab -l
WindowsTask SchedulerView in taskschd.msc

Remove the scheduled jobs.

Terminal window
nextdns-blocker watchdog uninstall
Removing watchdog jobs...
✓ NextDNS-Blocker-Sync removed
✓ NextDNS-Blocker-Watchdog removed
Watchdog uninstalled
Automatic syncing is now disabled
  • Before uninstalling NextDNS Blocker
  • When switching to Docker or another deployment
  • For debugging issues

Re-enable the watchdog after it was disabled.

Terminal window
nextdns-blocker watchdog enable
Watchdog enabled ✓
Automatic syncing will resume immediately

Temporarily disable the watchdog.

Terminal window
nextdns-blocker watchdog disable [HOURS]
ArgumentDefaultDescription
HOURSPermanentHours to disable (1-24)
Terminal window
# Disable for 1 hour
nextdns-blocker watchdog disable 1
# Disable for 4 hours
nextdns-blocker watchdog disable 4
# Disable permanently (until manually enabled)
nextdns-blocker watchdog disable
Watchdog disabled for 4 hours
Re-enables at: 2024-01-15 18:30:00
Use 'watchdog enable' to re-enable early
  • Debugging sync issues
  • Testing configuration changes manually
  • Temporarily managing blocking manually

Runs every 2 minutes:

  1. Executes nextdns-blocker config push
  2. Logs output to cron.log
  3. Handles errors gracefully

Runs every 5 minutes:

  1. Checks if sync job exists
  2. Recreates sync job if missing
  3. Logs recovery events to wd.log

This self-healing mechanism ensures blocking continues even if the sync job is accidentally deleted.

LogPurposeLocation
cron.logSync execution output~/.local/share/nextdns-blocker/logs/
wd.logWatchdog events~/.local/share/nextdns-blocker/logs/
Terminal window
# Sync logs
tail -f ~/.local/share/nextdns-blocker/logs/cron.log
# Watchdog logs
tail -f ~/.local/share/nextdns-blocker/logs/wd.log

Jobs are created as property list files:

Terminal window
# View installed jobs
ls ~/Library/LaunchAgents/com.nextdns-blocker.*
# View job details
plutil -p ~/Library/LaunchAgents/com.nextdns-blocker.sync.plist
# Manually load/unload
launchctl load ~/Library/LaunchAgents/com.nextdns-blocker.sync.plist
launchctl unload ~/Library/LaunchAgents/com.nextdns-blocker.sync.plist

Jobs are added to your user’s crontab:

Terminal window
# View cron jobs
crontab -l
# Expected entries
*/2 * * * * /path/to/nextdns-blocker config push >> ~/.local/share/nextdns-blocker/logs/cron.log 2>&1
*/5 * * * * /path/to/nextdns-blocker watchdog check >> ~/.local/share/nextdns-blocker/logs/wd.log 2>&1

Tasks are created in Task Scheduler:

Terminal window
# List tasks
schtasks /query /tn "NextDNS-Blocker-Sync"
schtasks /query /tn "NextDNS-Blocker-Watchdog"
# Open Task Scheduler GUI
taskschd.msc
# Manually run
schtasks /run /tn "NextDNS-Blocker-Sync"
  1. Check status:

    Terminal window
    nextdns-blocker watchdog status
  2. Reinstall:

    Terminal window
    nextdns-blocker watchdog uninstall
    nextdns-blocker watchdog install
  1. Check logs:

    Terminal window
    tail -20 ~/.local/share/nextdns-blocker/logs/cron.log
  2. Test sync manually:

    Terminal window
    nextdns-blocker config push --verbose
  3. Check scheduler service:

    Terminal window
    # Linux
    systemctl status cron
    # macOS
    launchctl list | grep nextdns

This might indicate permission issues. Check:

  1. Crontab permissions (Linux)
  2. LaunchAgents folder permissions (macOS)
  3. Task Scheduler service is running (Windows)

The watchdog job should automatically restore the sync job, but if both are disappearing, there’s a system issue.