在 Debian(以及大多数 Linux 发行版)下,使用 nohup 启动命令时,如果没有特别指定输出重定向,日志默认会写到当前目录下的 nohup.out 文件。
nohup your_command &
日志位置:
./nohup.out (执行命令时所在的目录)
查看日志:
tail -f nohup.out
# 或
cat nohup.out
通常会手动重定向输出:
nohup your_command > app.log 2>&1 &
日志位置:
./app.log
查看:
tail -f app.log
tail -f nohup.out
tail -n 100 nohup.out
grep "ERROR" nohup.out
可能原因:
可以查找:
find / -name nohup.out 2>/dev/null
生产环境不要依赖 nohup.out,建议:
nohup your_command >> /var/log/myapp.log 2>&1 &
或使用 systemd / screen / tmux 管理进程。
如果你愿意,可以贴一下你具体的 nohup 命令,我可以帮你确认日志到底在哪。