为什么我的nohup在putty中无效?
在我的 Putty 终端中,我输入了如下命令:
[username@vm186 bin]$ nohup ./mongod --dbpath ~/mongodb-data/ &
[1] 5967
[username@vm186 bin]$ nohup: appending output to `nohup.out'
然后,ps
显示 nohup
显然无效!
[username@vm186 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
所以,当我关闭窗口时,mongod 将收到信号并退出。
我的命令有什么问题吗?或者我的腻子配置有问题?
In my putty terminal, i typed the command as follows:
[username@vm186 bin]$ nohup ./mongod --dbpath ~/mongodb-data/ &
[1] 5967
[username@vm186 bin]$ nohup: appending output to `nohup.out'
then, ps
showed the nohup
is apparently invalid !!
[username@vm186 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我的系统(FreeBSD)上,nohup 不会与 ps 一起显示,但它启动的程序会显示,并且在关闭 putty 后仍然存在。关闭putty后你的程序退出了吗?
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 不应该继续运行。它只是重定向标准输出和标准错误,忽略 SIGHUP,并执行您请求的程序。请求的进程完全取代了 nohup,但继承了文件描述符和 SIGHUP 忽略。这就是防止进程在您注销时终止的原因。欲了解更多信息,请查看来源。您可能正在使用 来自 coreutils 的 nohup。
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.