ttyrun(8)

NAME
ttyrun - Start a program if a specified terminal device is available

SYNOPSIS
ttyrun [-V|--verbose] [-e|--exitstatus status] term program [program_options]
ttyrun [-h|--help]
ttyrun [-v|--version]

DESCRIPTION
ttyrun is typically started during system initialization and is used to prevent a respawn through the init(8) program when a terminal is not available. term is the name of the terminal device and is a path relative to the /dev directory, for example, specify hvc0 for /dev/hvc0.
If the specified terminal device can be opened, ttyrun starts the specified program. If the terminal device cannot be opened, the behavior of ttyrun depends on the -e option:

    •   If the -e option has been specified, ttyrun exits with the specified return value, or

    •   If the -e option has not been specified, ttyrun sleeps until it receives a signal that causes an exit.

program is an absolute path to the program to be started by ttyrun and program_options specify additional arguments. Depending on the program, arguments might be required. The variable %t in the program_options is resolved to the terminal device specified with term.

OPTIONS

-e, --exitstatus status
    Specifies an exit status that is returned when the terminal device is not available. status must be an integer in the range 1 to 255. You can use this status value in an upstart job file to prevent respawning.

-V, --verbose
    Displays syslog messages.

-h, --help
    Displays a short help text, then exits.

-v, --version
    Displays the version number of ttyrun, then exits.

RETURN VALUES
ttyrun exits with one of the following return values to report an error condition:

1   ttyrun has been started with an argument that is not valid or required but missing.

2   ttyrun could open the file specified for term but the file is not a terminal device.

3   ttyrun could not start the specified program.

The return values 1 to 3 might also be returned when the -e option is used and the terminal device is not available.

4 - 255
    The terminal device is not available and the -e option specifies an exit status in this range.

EXAMPLES

  inittab
To start /sbin/agetty on terminal device "hvc1", specify:

h1:2345:respawn:/sbin/ttyrun hvc1 /sbin/agetty -L 9600 %t linux

  upstart job/event files
To start /sbin/agetty on terminal device "hvc1", add the following settings to the job file:

respawn
normal exit 42
exec /sbin/ttyrun -e 42 hvc1 /sbin/agetty -L 9600 %t linux

With the normal exit statement, you specify an exit status that will prevent upstart from respawning the program. To prevent respawning with ttyrun, you must specify the same value for the -e option.

SEE ALSO
agetty(8), mingetty(8), inittab(5), events(5)