Open
Description
I am using PM2 to manage a python web service, initiated with a bash command.
this works:
pm2 start 'cd /home/nosson/synchronize && venv/bin/uvicorn server:app --host 0.0.0.0 --reload' --name synchronize
# [PM2] Starting /usr/bin/bash in fork_mode (1 instance)
# [PM2] Done.
# ┌────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
# │ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
# ├────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
# │ 0 │ synchronize │ default │ N/A │ fork │ 4917 │ 0s │ 0 │ online │ 0% │ 5.8mb │ nosson │ disabled │
# └────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
but when i try to specify a uvicorn log config log_config.yaml
, pm2 fails to start the service:
pm2 start 'cd /home/nosson/synchronize && venv/bin/uvicorn server:app --host 0.0.0.0 --reload --log-config log_config.yaml' --name synchronize
# [PM2][ERROR] File cd /home/nosson/synchronize && venv/bin/uvicorn server:app --host 0.0.0.0 --reload --log-config log_config.yaml not found
I suspect this is due to the logic which determines if the supplied command is a pm2 config file:
Lines 283 to 294 in e3a327f
which is called when starting the service
Line 328 in e3a327f
Logic for detecting config files as commands should be more precise, possibly checking if the entire command is a valid filename/path rather than a bash (or other) command
Metadata
Metadata
Assignees
Labels
No labels