* Added in conditional, as detaching will fail with "Operation not permitted" on linux; setsid sets a new process group anyway. * Added in variable to check detached state on cleanup, so we don't send TERM.