Skip to content

Supervisor

Supervisor

If you have background tasks that must keep running no matter what — processing queued jobs, handling real-time connections, or running custom worker scripts — Supervisor is the tool that keeps them alive. When a process crashes or the server reboots, Supervisor (a process control system for Linux) automatically restarts it so you never have to babysit it manually.

Supervisor daemon management

Supervisor manages what are called daemons — long-running background programs that operate silently behind the scenes without a user interacting with them directly.

Installing Supervisor

Supervisor is not installed by default. When you first visit the Supervisor tab, you will see a message: “Supervisor Not Installed.”

  1. Navigate to your server’s detail page and click the Supervisor tab.
  2. Click the Install Supervisor button.
  3. Wait for the installation to complete (usually under a minute).

Once installed, you can create and manage daemon processes.

Creating a Daemon

After Supervisor is installed, add a background process like this:

  1. Click Create Daemon (or Add New depending on your view).
  2. Fill in the daemon details:
    • Name — a descriptive label (e.g., “Laravel Queue Worker”)
    • Command — the full shell command to run (e.g., php /home/fly/site.com/artisan queue:work)
    • Number of Processes — how many parallel instances to run simultaneously
    • Directory — the working directory from which the command runs
  3. Click Save.

Supervisor starts the daemon immediately and monitors it from that point forward.

Managing Daemons

Each daemon in the list supports these actions:

ActionWhat It Does
StartStarts a stopped daemon
StopGracefully stops the daemon
RestartStops and then starts the daemon (useful after deploying new code)
DeletePermanently removes the daemon configuration

Common Use Cases

Here are typical daemons you might configure, along with example commands:

DaemonCommand ExamplePurpose
Queue workerphp artisan queue:work --tries=3Processes background jobs in a Laravel app
WebSocket servernode /home/fly/app/websocket.jsMaintains persistent real-time connections
Custom worker/home/fly/scripts/process-uploads.shRuns a custom background shell script

Before adding a daemon, verify the command works correctly when you run it manually via SSH (secure shell access to your server). A misconfigured command causes Supervisor to enter a restart loop, which can consume significant server resources.

Supervisor vs. Cron Jobs

Not sure whether to use Supervisor or a cron job (a task scheduler that runs commands at set times)? This table helps:

FeatureSupervisorCron Jobs
PurposeLong-running processes that should always be activeTasks that run at scheduled intervals
ExecutionRuns continuously, restarts on crashRuns once at the scheduled time
Best forQueue workers, WebSocket serversCleanup scripts, backups, scheduled reports

Best Practices

  • Set the right number of processes — for queue workers, 1–3 processes is usually sufficient for a single server. Too many processes can exhaust your available RAM.
  • Use descriptive names so you can identify at a glance what each daemon does.
  • Restart daemons after deployments to ensure they pick up your latest code changes.
  • Monitor resource usage on the Status tab to catch any daemons consuming excessive CPU or memory.