Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nohup: can't detach from console

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.

like image 788
Chris Avatar asked May 27 '14 20:05

Chris


1 Answers

try this :

nohup <utility> <arg> > output.txt 2> error.txt >/dev/null &
like image 144
michael501 Avatar answered Sep 19 '22 07:09

michael501