[Previous] [Contents] [Next]

on

Execute a command on another node or tty (QNX)

Syntax:

on [-d] [-f nid] [-h] [-n node] [-p prio] [-r root]
   [-s] [-t tty] command

Options:

-d
Detach command from its parent (i.e. sever the parent/child relationship). This is useful for remotely created processes that will never exit and that the Shell therefore doesn't need to wait for. Unless this option is specified, a virtual circuit is created connecting the parent to the child.
-f nid
Spawn from remote node using remote node's / as prefix root. Equivalent to -n node -r //node/.
-h
Start command in a HELD state. This option is useful for starting up programs with the intention of debugging them. You can also start up several commands in the HELD state, then send them all a signal to start -- they'll all start at almost the exact same time, since their load times will have been eliminated.
-n node
Execute command on the specified node. This is identical to the onnode command built into sh.
-p prio
Execute the command at the specified priority.
-r root
Use the specified default network root for command.
-s
Spawn the command in a new process group.
-t tty
Open the specified terminal name as file descriptors 0, 1, and 2 for command. The command is run in a new session with tty as its controlling terminal. This is identical to the ontty command built into sh.
command
The command to be executed.

Description:

The on utility extends the process creation abilities of the Shell (sh). You can start a process on a remote node, on a different controlling terminal, in a HELD state for debugging or later synchronized starting, or with a default network root that differs from the one used by its parent.

If the -d option is not specified, a virtual circuit is created as a local agent for the remote child process. When the child terminates, the parent must do a wait() on the virtual circuit to reap the zombie process entry for the child. If the -d option is specified, the command is detached from its parent. The parent won't be able to do a wait() for the child, nor will it be able to control it via signals.

By default, the command is run in the current session. The -t option starts a new session, which means the command won't receive a SIGHUP if the current session leader terminates.


Caution: The on -t command will become the new session leader on the tty specified, i.e. it will receive SIGHUP generated by hangups on that tty. Any processes originally running on that tty will NOT get SIGHUP, and this condition will persist even when the process started by on has terminated. For this reason, on -t should specify only ttys that are not currently in use.

Examples:

Run login on console 2:

    on -t /dev/con2 login

Run who on node 3:

    on -n 3 who

Run sort as an orphan on node 3:

    on -d -n 3 sort file.dat

Run who on node 7 with a new session, its standard I/O connected to console 1 on node 3:

    on -t //3/dev/con1 -n7 who

Run make on node 3, using node 3 as the network root -- this eliminates the need to resolve pathnames through the invoking node:

    on -n 3 -r //3/ make

Exit status:

The on utility exits with the exit status of the command.

See also:

sh


[Previous] [Contents] [Next]