当前位置: 动力学知识库 > 问答 > 编程问答 >

linux - Why is my nohup invalid in putty?

问题描述:

In my putty terminal, i typed the command as follows:

[[email protected] bin]$ nohup ./mongod --dbpath ~/mongodb-data/ &

[1] 5967

[[email protected] bin]$ nohup: appending output to `nohup.out'

then, ps showed the nohup is apparently invalid !!

[[email protected] bin]$ ps -auxw | grep mongo

username 5967 0.0 0.0 76172 4716 pts/8 Sl 10:03 0:00 ./mongod --dbpath /home/username/mongodb-data/

username 6140 0.0 0.0 61192 780 pts/8 S+ 10:04 0:00 grep mongo

So, when i close the window, mongod will receive the signal and quit.

What's wrong with my command? or something wrong with my putty configuration?

网友答案:

On my system (FreeBSD) nohup won't show with ps, but the program it starts will show, and will survive closing putty. Did your program exit after closing putty?

网友答案:

Nohup is not supposed to continue running. It just redirects standard output and standard error, ignores SIGHUP, and executes the program you requested. The requested process totally replaces nohup but inherits the file descriptors and SIGHUP ignoring. That's what prevents the process from terminating when you log out. For more information, look at the source. You're probably using nohup from coreutils.

分享给朋友:
您可能感兴趣的文章:
随机阅读: