在 CentOS 里用 nohup 启动程序时,默认会把输出重定向到当前目录下的 nohup.out 文件(除非你自己指定了日志文件)。
cat nohup.out
或者实时查看:
tail -f nohup.out
比如你这样启动的:
nohup python app.py > app.log 2>&1 &
那就看 app.log:
tail -f app.log
tail -n 100 nohup.out
tail -f nohup.out
grep ERROR nohup.out
less nohup.out
(按 q 退出)
如果找不到 nohup.out:
ls -l nohup.out
或:
find / -name nohup.out 2>/dev/null
也可以看进程启动命令:
ps -ef | grep 你的程序名
2>&1 表示标准错误也写入日志logrotate)如果你愿意,可以把你启动命令或报错信息发出来,我可以帮你具体分析。