How can I launch applications from 2 ttys on launch?

6,313

I think it's possible to start whatever you want from /etc/inittab

e.g. (/etc/inittab excerpt)

# TERMINALS
c1:12345:respawn:/sbin/agetty 38400 tty1 linux

# Launch top redirecting its output to tty2, without redirecting input
c2:2345:respawn:/usr/bin/top >/dev/tty2 2>&1

# Launch ascii-invaders with redirected input 
# (you will be able to control the game with keyboard after switching to tty3)
c3:2345:respawn:/usr/games/bin/ascii-invaders </dev/tty3 >/dev/tty3 2>&1
Share:
6,313

Related videos on Youtube

thewebguy
Author by

thewebguy

Hello there! http://twitter.com/thewebguy

Updated on September 18, 2022

Comments

  • thewebguy
    thewebguy over 1 year

    I've currently got 2 ttys logging in automatically, but I need to launch a node script from one and a C program from another as soon as the device loads.

    The device is a Raspberry Pi running Raspbian. It's set up to function like an appliance, these two programs will run for a few hours at a time before the device is turned off.

    I've successfully launched my programs via /etc/rc.local but it seems that this isn't the same as actually launching from tty, they are closed before the prompt loads.

    • donothingsuccessfully
      donothingsuccessfully over 11 years
      Have you tried openvt myprogram? It should create a tty and run your command there.
    • thewebguy
      thewebguy over 11 years
      @donothingsuccessfully Thanks, this is what I needed!