English
Supervisor
Overview
Supervisor is a process control system for Linux. It keeps processes running and automatically restarts them if they stop unexpectedly. You can use it to run queue workers, websockets, laravel-echo-server, and other long-running processes. FlashPanel uses Supervisor to manage these processes and keep them running reliably.
Which tool should I use?
Supervisor configuration
You can set up a Supervisor process via the server's Supervisor menu. Steps:
Select the server, click the
Supervisormenu, then click theCreatebuttonIn the
New Supervisordialog, fill in the process information:- Description (Optional): Brief description of the process
- Command: Command to run. For example:
php artisan queue:work. If you use a relative path like this one, set Directory to the website folder (e.g./home/flashpanel/example.com), or use the full path:php /home/flashpanel/example.com/artisan queue:work - User: System user that runs the command,
flashpanelby default - Directory (Optional): Directory to run the command from; pick a suggestion. Leave it blank if the command already uses full paths
- Number Processes: Number of instances of the process to run in parallel
- Start Seconds: The total number of seconds the program needs to stay running to be considered successfully started
Click
Save
Once created, the process appears in the table. The Status column shows the state read directly from Supervisor on the server, refreshed every 30 seconds while the page is open (click Refresh to read it right away; the time of the last read is shown next to the button):
- Running: All processes are running. With Number Processes above 1, the column also shows how many are running, for example
2/2 - Starting, Stopping: The process is changing state
- Retrying: The process exited before Start Seconds and Supervisor is starting it again
- Stopped: The process was stopped
- Exited: The process exited after starting successfully
- Failed to start: Supervisor gave up after several failed attempts. Check Show Log to find out why
- Not loaded: Supervisor on the server does not have this process, for example when installing the config failed. Edit and save it to install the config again
When a group has several processes in different states, the most serious state is shown. Hover over the status to see the state of each process.
The buttons at the end of the row:
- Start, Stop, Restart: Control the process. The command runs in the background and is shown in Events; when it finishes, the status is read again from the server. If the process fails to start, the event shows the error from Supervisor. Start is greyed out while all processes are running and Stop is greyed out while none is running. All buttons are greyed out while the process is being installed, deleted or changing state, or when it is Not loaded.
- Show Log: View the process log output. The log opens in a floating window that you can move, resize or minimize, with the colors written by the program kept. Choose how many Lines to show, turn on Auto refresh to reload every 5 seconds, or click the refresh button to reload once.
- The ⋮ menu:
- Edit: Edit the process configuration
- Clone: Create a new process from the existing configuration
- Clear Log: Clear the process log file
- Delete: Remove the Supervisor configuration (click
Confirmto finish)
Log files
FlashPanel automatically configures each Supervisor process to write its own log file. The log files are stored in the /home/flashpanel/.flashpanel/ directory and are named daemon-<ID>.log, where <ID> is the value in the table's ID column. If the process runs as the root user, the log file is stored in /root/.flashpanel/.
WARNING
If you use the user isolation feature of FlashPanel, the log file is in the .flashpanel folder inside the home directory of the user selected in the User field (for example /home/<username>/.flashpanel/).