alxpanel-process
Lets a hosting account list, show and restart its own background processes from SSH or a cron job.
Background processes, such as a queue worker or a Node.js server, are set up in the panel on the account's Processes page. Background processes explains how they run. This command is for the account's own user, not for root. Its typical use is the last line of a deploy script: restart the worker so it picks up the new code.
Usage
alxpanel-process list
alxpanel-process status <name>
alxpanel-process restart <name>
<name> is the process's name as shown in the panel.
list and status
$ alxpanel-process list
NAME STATE PORT RESTARTS
queue running - 0
ssr running 20417 2
STATE is running, restarting or stopped. PORT is - for a process without one.
restart
$ alxpanel-process restart queue
restart of queue requested (now running)
The restart is queued and the command returns at once; status shows the outcome. It acts only on a process that is switched on in the panel: it never starts one that is switched off, and never stops one.
Who may run it
The account's own user, from an SSH session, a cron job or another background process. The server knows the account from the user who runs the command, so there is nothing to configure and no way to name another account.
It answers not permitted to root, and to anything that runs inside a website: PHP code and the file manager cannot restart processes.
Refusals
| Message | Why |
|---|---|
not permitted |
See above. |
no process named "…" |
Check the name with list. |
process "…" is switched off |
Switch it on in the panel first. |
restarted moments ago |
One restart per process every 5 seconds. |
too many restarts at once, try again shortly |
|
process "…" is not available right now |
Its service is not enabled on the server right now. Try again shortly; if it stays, save the process again in the panel. |
account is suspended |
|
the server is busy, try again shortly |
Exit codes
| Exit code | Meaning |
|---|---|
| 0 | Done. |
| 1 | Refused or failed; the reason is on standard error. |
| 2 | Wrong usage. |
Example: a deploy script
git pull
composer install --no-dev
php artisan migrate --force
alxpanel-process restart queue