Skip to content
This documentation is in construction.

Manage Processes

Modules can register their own long-running tasks (for example: schedulers, workers, …).

To avoid having to maintain a dedicated supervisor for each module, the system provides a unified command capable of supervising all declared module processes.

This page explains how to start, reload, and keep this worker running in production.

The epsicube:work command starts all module-defined long-running tasks and supervises them continuously.

Terminal window
php artisan epsicube:work
[12:51:11] [Supervisor] Starting sub-processes…
[12:51:11] [Supervisor] Starting 'schedule'…
[12:51:11] [Supervisor] Starting 'queue'…
[12:51:12] [schedule] INFO Running scheduled tasks.
...

Once started, the worker continues running until manually stopped or until the terminal is closed.

You can trigger a full reload of all running sub-processes using:

Terminal window
php artisan epsicube:reload

This broadcasts a restart signal that forces epsicube:work to gracefully stop and restart each managed task:

Broadcasting reload signal.

This is particularly useful when deploying changes that affect worker-level logic.

To ensure it stays active after crashes, timeouts, or server restarts, you should use a process monitor, such as Supervisor.

Supervisor configuration files are typically stored in the /etc/supervisor/conf.d directory. Within this directory, you may create any number of configuration files that instruct supervisor how your processes should be monitored. For example, let’s create a epsicube-worker.conf file that starts and monitors epsicube:work processes:

[program:epsicube-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/your/application/artisan epsicube:work
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/path/to/your/application/storage/logs/worker.log
stopwaitsecs=3600

Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:

Terminal window
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start "epsicube-worker:*"

For more information on Supervisor, consult the Supervisor documentation.