on Command

Purpose

Executes commands on remote systems.

Syntax

/usr/bin/on [ -i ] [ -d ] [ -n ] Host Command [ Argument ... ]

Description

The on command executes commands on other systems in an environment that is similar to the one running the program. The on command passes the local environment variables to the remote machine, thus preserving the current working directory. When using the on command, both users must have the same user identification. Relative path names work only if they are within the current file system. Absolute path names can cause problems since commands are issued at one machine and executed on another.

The standard input is connected to the standard input of the remote command. The standard output and standard error from the remote command are sent to the corresponding files for the on command. The root user cannot execute the on command.

Attention: When the working directory is remotely mounted over the Network File System (NFS), the Ctrl-Z key sequence causes the window to hang.

Flags

Item Description
-d Specifies debug mode. Displays status messages as work progresses.
-i Specifies interactive mode. Uses remote echoing and special character processing. This option is needed for programs that expect to be talking to a terminal. All terminal modes and window size changes are increased.
-n Specifies no input. This option causes the remote program to get an end-of-file (EOF) message when it reads from standard input. This flag is necessary when running commands in the background with job control.

Example

To execute the ls -al command on another machine and display the in-progress status messages on your terminal, enter:

on  -d zorro ls -al

In this example, the on command executes the ls command on a workstation named zorro.

Files

Item Description
 /etc/inetd.conf Defines how the inetd daemon handles Internet service requests.