Linux中nohup启动不输出日志怎么解决

avatar
作者
筋斗云
阅读量:0

在Linux中,使用nohup命令启动后台进程时,输出会被重定向到nohup.out文件中。如果需要查看实时日志,可以通过以下方式解决:

  1. 使用tail命令实时查看日志:

    tail -f nohup.out 
  2. 将nohup命令的输出重定向到其他文件,并通过tail命令查看:

    nohup command > logfile & tail -f logfile 
  3. 使用tee命令将输出同时重定向到文件和标准输出:

    nohup command | tee logfile 
  4. 在nohup命令中使用输出重定向符号将输出重定向到/dev/null,这样输出将被丢弃:

    nohup command > /dev/null & 

请根据实际需求选择合适的方法。

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!