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

تم الإنشاء في: ٢٧ أكتوبر ٢٠٢٦

تمت الإجابة باستخدام GPT-5.6 Thinking بواسطة Chat01

سؤال

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

الفكرة

Worked for a couple of seconds

الإجابة

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/虚拟环境,先激活对应环境,再执行上面的命令即可。

مشاركة هذا السؤال والجواب