[Previous] [Contents] [Next]

tinit

Terminal initialization (QNX)

Syntax:

tinit [-T device...] [-c command] [-f optionfile]
      [-m minutes] [-t device...] &

Options:

-c command
Start command on the devices specified by the -t or -T option. The default is login -p. This affects all -t and -T options to the right on the command line.
-f optionfile
The specified text file contains more command-line options. This is useful in systems with large numbers of options (typically -c or -t options) that would result in long and complex command lines.
-m minutes
If the line is idle (no input) for the indicated number of minutes, set a SIGHUP signal on the process group of that controlling terminal. If minutes is zero (the default), the idle timeouts are disabled. This affects all -t and -T options to the right on the command line.
-r seconds
Retry period. When tinit is unable to start the command on a tty (e.g. when the device is still is use by another process), it will schedule a periodic retry to see if the device has become free. The default is 60 seconds, which may be made smaller or greater using this option.
-t device
Start command immediately on this device. If device does not start with a /, it is assumed that the file exists under the /dev directory.
-T device
Start command on this device when any character is input. If device does not start with a /, it is assumed that the file exists under the /dev directory.

Description:

The tinit utility lets you bring up login (or other programs) on devices. You normally use tinit to invoke login -p on the console(s) and serial terminals. It runs as a background process, and is nearly always started in the sysinit file.

After creating the specified commands as its children, tinit waits for any of them to terminate. When one of these commands terminates, tinit re-invokes the command on that device.

For example, let's assume that tinit started a login on /dev/con1. After logging in, the user is presented with a shell. Then, after executing any number of commands, the user decides to terminate the shell. At this point, tinit detects the death and starts a new login on /dev/con1.

The list of terminal devices on which you want the command to be started can be specified by one or more -T or -t options. If a device appears more than once, the utility will use the parameters in effect for the last use on the command line. You may use a separate -T or -t for each device or use spaces in order to specify several devices, e.g.:

    -t con2 -t con1

or

    -t con2 con1

If the device name doesn't start with a slash, it's assumed the name starts with the following:

    /dev/

The tinit utility scans its options left to right. Each -c replaces the currently defined command and each -m replaces the currently defined timeout. The -t and -T options memorize the current settings for starting a command on a device. For example:

    -t con1 -c "modem -L -b 57600" -m 10 -t ser1

would start login -p (default -c) with no timeout (default -m) on /dev/con1, then start modem with a 10-minute timeout on /dev/ser1.

For devices specified with the -T option, tinit doesn't start the command right away. Instead, it waits for any character to be received from the device.

If you want to start several different commands on many devices, the command line for tinit may become very long. You can use the -f option to specify a file that contains options. Unlike command-line options, which are expanded by the shell, the options in this file are taken as is. For example, -t /dev/con* in a file will not be expanded.

If you want to group several blank-separated words into a single argument, enclose them in double quotes (").

Here's an example of a possible option file:

    -t con1 -T con2 con3 con4
    -c "modem -b 57600 -L" -m 10 -t ser1 ser2
    -c "modem -b 57600" ser3

You can mix options on the command line and file options. File options are always processed after command-line options.

If tinit tries to start or restart a command, and the command fails to load, tinit retries once every minute until it is successful.

The tinit utility will log each command invocation to the file /etc/acclog, provided the file exists. For details, see the QNX Installation & Configuration manual.

Examples:

Set up tinit to bring up logins in response to a character being typed on any of the console devices, except /dev/con1, on which a login will be brought up immediately without a key being typed:

tinit -T /dev/con* -t con1 &

Set up consoles /dev/con1 and /dev/con2 to have login -p started on them immediately, and the serial port /dev/ser1 to have modem started on it:

tinit -t con1 con2 -c "modem -b 19200 -L" -t ser1 &

Start tinit using the options specified in the file /etc/config/tinit:

tinit -f /etc/config/tinit &

Files:

/etc/acclog
Accounting records are appended to this file.

Caveats:

The tinit manager will not bring up a new login (or the specified command) regardless of -t or -T settings if any other process currently has that tty open. This means, for example, that if someone is dittoing a console and logs off, nobody (neither the person running ditto nor the person actually sitting at the console) will be able to bring up a new login until ditto detaches from that console.

See also:

login, modem, sinit, termdef


[Previous] [Contents] [Next]