Chris Marriott
08/20/2026, 9:30 AMprefect server start --background. Can I create a background process for a Prefect worker too?Marvin
08/20/2026, 9:30 AMMarvin
08/20/2026, 9:33 AMprefect worker start does not have a built-in --background option.
For a quick background process on Linux/macOS:
nohup prefect worker start --pool my-pool \
> prefect-worker.log 2>&1 &
echo $! > prefect-worker.pid
Stop it gracefully with:
kill "$(cat prefect-worker.pid)"
For a persistent worker, prefer a process manager such as systemd, Supervisor, Docker, or Kubernetes so it restarts after crashes or reboots.
Also, Prefect 2.x is no longer under active development; current development is on Prefect 3.x.Chris Marriott
08/20/2026, 9:34 AMMarvin
08/20/2026, 9:34 AMMarvin
08/20/2026, 9:34 AM--background option. From PowerShell, you can detach the worker with:
$worker = Start-Process prefect `
-ArgumentList "worker start --pool my-pool" `
-WindowStyle Hidden `
-RedirectStandardOutput "prefect-worker.log" `
-RedirectStandardError "prefect-worker-error.log" `
-PassThru
$worker.Id | Set-Content "prefect-worker.pid"
Stop it later with:
Stop-Process -Id (Get-Content "prefect-worker.pid")
For a worker that should survive reboots and restart on failure, run it as a Windows service using a service manager such as NSSM, or use Windows Task Scheduler. That’s preferable to Start-Process for production.