Invoke a command/script disconnected from the controlling terminal?
You need to start another session not attached to a terminal, so for instance:
$ setsid sh -c 'tty; ps -jp "$$"; echo test' < /dev/null > log 2>&1
$ cat log
not a tty
PID PGID SID TTY TIME CMD
19506 19506 19506 ? 00:00:00 sh
test
See also the start-stop-daemon
command found on some Linux distributions. There's also a daemon
command.