Upstart examples for logins

On distributions that use Upstart, you can set up login programs for HVC terminal devices through Upstart job files.

You can use names of your choice for the file names of your Upstart job files. The directory where you must place the file depends on your distribution.

  • This Upstart job file enables user logins on terminal device hvc1 with mingetty.
    start on runlevel [2345]
    stop on runlevel [01]
    respawn
    exec /sbin/mingetty --noclear hvc1

    With mingetty, you must explicitly export the TERM environment variable to specify the terminal capabilities.

  • This Upstart job file enables user logins on terminal device hvc2 with agetty and sets the TERM environment variable to xterm at startup.
    start on runlevel [2345]
    stop on runlevel [01]
    respawn
    exec /sbin/agetty -L 9600 hvc2 xterm

    With agetty, you can specify the value to be set for the TERM environment variable as a parameter.

  • This Upstart job file enables user logins on terminal device hvc3 with agetty and sets the TERM environment variable to xterm at startup. The ttyrun program prevents recurrent respawns by stopping with return code 123 if the terminal is not operational.
    start on runlevel [2345]
    stop on runlevel [01]
    respawn
    normal exit 123
    exec /sbin/ttyrun -e 123 hvc3 /sbin/agetty -L 9600 %t xterm
  • This Upstart job file enables user logins in single user mode on terminal device hvc0. Instead of /bin/login, the default login program, the /sbin/sulogin login program is used.
    start on runlevel S
    stop on runlevel
    exec /sbin/sulogin hvc0
    Note:
    • The /sbin/sulogin login program requires a login by user root
    • The runlevel specification for single user mode and for emergency mode depends on your distribution.