Ven*_*war 2 linux centos systemd
I am running the gunicorn server as a service via systemd, Here is the sample service file:
[Unit]
Description=Gunicorn NGINX
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/test
ExecStart=/usr/local/bin/gunicorn --workers 8 --threads 8 --backlog 100 --bind 10.0.0.20:5000 -m 777 abc:app
Restart=always
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我现在想使用shell命令替换核心附近--workers和--threads核心数目,以便它可以动态地选择核心数目
nproc --all
Run Code Online (Sandbox Code Playgroud)
有人可以帮我怎么做吗
您可以显式调用Shell以获得Shell解析。
ExecStart=/bin/bash -c '/usr/local/bin/gunicorn --workers "$(nproc --all)" --threads "$(nproc --all)" --backlog 100 --bind 10.0.0.20:5000 -m 777 abc:app'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1875 次 |
| 最近记录: |