I am trying to detach a process from a bash script so that SIGINT will not be forwarded to the process when I exit the script.
I have used the disown
command in terminal directly, however in bash, disown
does not stop SIGINT from being forwarded. The purpose of this script is to start openocd and then gdb with a single invocation. Since the script never exits (it's running gdb) SIGINT is still forwarded from gdb to openocd which is a problem since SIGINT is used as the halt command in gdb.
In terminal it would look something like this:
$ openocd & # run openocd demonized
$ disown $! # disown last pid
$ gdb # invoke GDB
when invoked on terminal in this order, the SIGINT is not passed from gdb to openocd. However if this same invocation was in a bash script, the SIGINT is passed.
Any help would be greatly appreciated.
ps this problem is in OS X but I am trying to use tools which are also portable to all Unix tools.
nohup
isn't quite the right answer. You should add some pseudocode or example code to show more precisely what you want.screen
?