如何看到守护daemon进程的标准输出log

可以gdb 来实现:

gdb -p pid 某个进程
gdb > call close(1)
(gdb) > call dup2(creat(“/var/log/print.log”,0666),1)
(gdb) > quit

#!/bin/sh
LOG_FILE=”/var/log/debug_gdb.txt”

if [ ! -n “$1” ] ;then
echo -e “please input process pid”
exit
else
echo $LOG_FILE
fi

gdb -p $1 <<EOF
call close(1)
call dup2(creat(“/var/log/debug_gdb.txt”,0666),1)
quit
EOF
上一篇:docker


下一篇:hadoop三种启动方式