CLI · Winter Console

The daemon command

A daemon is not one process but a fleet: a supervisor and its workers. The daemon command manages the fleet as a whole and shows every worker separately — what state it is in, how long it has run and how many times it has restarted.

Alias call dmnActions list · start · stop · statusShows the fleet worker by worker

How it differs from process

process manages a single task; daemon manages a long-lived component that has subordinate workers, a restart policy and scaling. Hence the difference in output: a process has one PID, a daemon has a supervisor plus a table of slots.

The commands are deliberately separate: a daemon will not appear in the process list, and vice versa. What daemons are and how to write them is on the Daemons page.

What the project has

bash
php call daemon list
php call dmn list           # the same thing
text
[ Available Daemons ]
[D] main.daemon.QueueDaemon        ● running   workers 4
[D] main.daemon.NotifyDaemon       ○ stopped
- - - - - - - - - -
[i] 2 defined, 1 running.

The class is given in dot notation: main.daemon.QueueDaemon corresponds to Main\Daemon\QueueDaemon.

Starting and stopping

bash
php call dmn main.daemon.Queue                # supervise in foreground
php call dmn main.daemon.Queue start -d       # detached
php call dmn main.daemon.Queue stop           # graceful stop of the whole fleet

In the foreground the supervisor occupies the terminal — convenient while debugging: you see the workers come up and what they write. With -d the fleet goes into the background and the command prints the supervisor’s PID.

stop stops the whole fleet: the supervisor stops raising new workers and lets the running ones finish their current task. An individual worker is not killed separately — that is the supervisor’s job.

Fleet status

bash
php call dmn main.daemon.Queue status
text
[ Daemon Status ]
main.daemon.Queue          Daemon ● RUNNING
- - - - - - - - - -
PID          51024
State        RUNNING
Activity     BUSY
Started      2026-08-14 06:40:11
Uptime       7h 52m
Workers      4
Restarts     2
- - - - - - - - - -
[ Workers (4) ]
SLOT   PID      STATE       ACT    UPTIME    RESTARTS
#0     51031    running     busy   7h 52m    0
#1     51032    running     idle   7h 52m    0
#2     58840    starting    idle   —         2
#3     51034    retiring    busy   7h 52m    0

The daemon’s Restarts field is how many times the supervisor raised workers anew; a particular slot’s is how many times that slot itself restarted. A slot with a growing counter while its neighbours sit at zero means a specific task is failing, not the daemon.

Worker states

State What is happening
starting Coming up, has not begun working yet
running Working normally
retiring Being retired gracefully: takes no new work, finishes the current one
killing Did not exit nicely — being terminated forcibly
restarting Exited and is coming back up under the restart policy
empty The slot is free — there is no worker in it right now

The ACT column is the same as for processes: busy means useful work right now, idle means waiting. A fleet of four idle workers next to a growing queue is a reason to look not at the daemon but at the source of the tasks.

Supervisor resources

bash
php call dmn main.daemon.Queue status -v

The flag adds the supervisor’s resource usage — the user, the PPID, CPU, memory, elapsed time. The command does not show individual workers’ resources: their PIDs are in the table, and you look those up with system tools.

Every action

Command What it does
list Every daemon in the project, its state and worker count
<Class> The supervisor in the foreground
<Class> start -d The supervisor in the background
<Class> stop A graceful stop of the whole fleet
<Class> status The state plus the worker table
<Class> status -v Plus the supervisor’s resources

Next

  • Daemons — how to write daemons, restart and scaling policies
  • process — single processes
  • schedule — scheduled tasks
  • run — starting daemons together with the application