python example_new_datasets.py 改成后台运行不中断的ubuntu命令

Created on: October 27, 2026

Answered using GPT-5.6 Thinking by Chat01

Question

python example_new_datasets.py 改成后台运行不中断的ubuntu命令

Thought

Worked for a couple of seconds

Answer

Ubuntu 上可以这样后台运行,退出 SSH 后也不会中断:

bash
nohup python example_new_datasets.py > example_new_datasets.log 2>&1 &

查看是否还在运行:

bash
ps aux | grep example_new_datasets.py

实时看日志:

bash
tail -f example_new_datasets.log

如果你想更稳一点,可以加 disown:

bash
nohup python example_new_datasets.py > example_new_datasets.log 2>&1 & disown

如果你用的是 Conda/虚拟环境,先激活对应环境,再执行上面的命令即可。

Share this Q&A