Nohup:无法与控制台分离 [英] Nohup: can't detach from console

查看:155
本文介绍了Nohup:无法与控制台分离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在Linux和Mac OS X上运行的bash脚本.该脚本的某一行在Linux中可以正常运行,但在OS X中不能.

I have a bash script that will run in both Linux and Mac OS X. One particular line of the script works as is in Linux, but not in OS X.

nohup <utility> <arg> > output.txt 2> error.txt </dev/null &

当bash脚本在Linux中运行时,它就像一个超级按钮.但是,在OS X中运行bash脚本时,出现错误

When the bash script runs in Linux, it works like a charm. However, running the bash script in OS X, I get the error

nohup: can't detach from console: Inappropriate ioctl for device

我已经做了很多搜索,但是还没有找到合适的答案来解释为什么这样.

I've done a lot of searching and haven't found a suitable answer as to why this is behaving as such.

执行脚本早于<utility>退出,这就是为什么(据我所知)我需要使用nohup的原因.但是,我已经进行了一些测试,从bash脚本的行中删除nohup似乎可以解决问题,因为这两个系统上的实用程序都将启动,甚至在脚本退出后仍可以继续运行.

The executing script exits long before the <utility>, which is why (as far as my knowledge goes) I need to use nohup. However, I've done some testing, and removing nohup from the line in the bash script seems do the trick in that the utility on both systems will launch, and continue to run even after the script exits.

推荐答案

尝试一下:

nohup <utility> <arg> > output.txt 2> error.txt >/dev/null &

这篇关于Nohup:无法与控制台分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆