Nohup: can't detach from console

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 13:54:11

问题


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 &

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.

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.


回答1:


try this :

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


来源:https://stackoverflow.com/questions/23898623/nohup-cant-detach-from-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!