Docs

⌘K
  1. Home
  2. Docs
  3. Server
  4. Using Supervisor Daemons in FlyWP

Using Supervisor Daemons in FlyWP

Supervisor is a robust process control system that enables you to keep background scripts (such as Python applications or automation jobs) running reliably. FlyWP includes a built-in Supervisor integration, allowing you to manage daemons directly from your server dashboard.

What is a Supervisor Daemon?

A daemon is a background process that runs independently of interactive user sessions. Supervisor ensures that these daemons are managed correctly, allowing:

  • Automatic startup on server boot
  • Process monitoring and auto-restart on failure
  • Access to stdout and stderr logs
  • Manual process control (start, stop, restart)

Common Use Cases

  • Automation scripts (e.g. scheduled backups, remote data sync)
  • Background Python services or log processors
  • Queue consumers or lightweight job workers
  • Custom monitoring scripts

How to Create a Daemon in FlyWP

  1. Navigate to the server.
  2. Go to the Supervisor tab in the left sidebar.
  3. Click Add Daemon.
  4. Complete the form:
    • Command: Full command to execute your script (e.g. python3 /home/fly/my_script.py)
    • Working Directory: Directory where the script resides (e.g. /home/fly)
    • User: System user to run the process (typically fly)
    • Number of Processes: Usually set to 1 unless parallel instances are needed
    • Start Seconds: Seconds to wait before marking the process as successfully started
    • Stop Seconds: Grace period in seconds before the process is forcefully stopped
    • Stop Signal: Signal used to stop the process (e.g. TERM for graceful shutdown)
  5. Click Create Daemon.

Once created, FlyWP will start the process and track its status automatically.

Managing Daemon Status

After creation, daemons are listed in the Supervisor panel with their current state:

  • Running: The process is active and healthy
  • Stopped: The process is not running
  • Creating/Starting: The process is initializing or restarting

You can manage each daemon via the three-dot menu:

  • Start
  • Stop
  • Restart
  • Delete

Example: Simple Python Daemon

Create a file at /home/fly/test_daemon.py:

Use this in the FlyWP “Add Daemon” form:

  • Command: python3 /home/fly/test_daemon.py
  • Working Directory: /home/fly
  • User: fly
  • Remaining fields can be left as defaults unless specific tuning is needed.

Troubleshooting Tips

  • Ensure the script has executable permissions and correct file path
  • Validate that Python is installed and available as python3
  • Check logs under /var/log/supervisor/ for runtime errors
  • If the script exits immediately, Supervisor may continuously restart it

Removing a Daemon

  1. Go to the Supervisor page in FlyWP.
  2. Find the daemon in the list.
  3. Click the three-dot menu next to it.
  4. Select Delete. This will stop and remove the daemon from the Supervisor process list.

Advanced Configuration

FlyWP’s Supervisor integration provides several advanced options for managing background processes effectively:

Monitoring and Failure Recovery
Supervisor automatically restarts processes that exit unexpectedly to ensure high availability.Graceful Shutdown Handling
Customize how processes are terminated using stop signals such as TERM, QUIT, or KILL.Delayed Starts for Dependent Services
Set a delay before starting the process to ensure that dependencies are fully initialized.Multi-Process Configuration
Run multiple instances of a script when concurrency is required.
Log Access
Users can view both standard output and error logs directly from the FlyWP dashboard.

Support

If your daemon is not starting or behaving unexpectedly:

  • Double-check the script path and syntax
  • Ensure Python is available in the specified environment
  • Review Supervisor logs or status
  • Contact FlyWP support with the daemon ID and command details