为什么nohup后台进程没有启动

为什么nohup后台进程没有启动

我正在使用此脚本来启动我的应用程序:

#!/usr/bin/env bash
set -u
set -e
set -x

nohup pdm run python3.10 /root/visa/main_api.py > /root/visa/starup.log &

tail -f /root/visa/starup.log

当我在 ternimal 中将脚本作为 shell 命令执行时./scripts/startup.sh,该进程未启动。但是当我在 shell 中单独运行后台启动命令时,如下所示:

nohup pdm run python3.10 /root/visa/main_api.py > /root/visa/starup.log &

效果很好。为什么在 shell 命令中运行时进程没有启动?我应该怎么做才能从 shell 脚本运行这个后台命令?

相关内容