LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Need to switch tty or send system msgs to tty2 (https://www.linuxquestions.org/questions/linux-general-1/need-to-switch-tty-or-send-system-msgs-to-tty2-77932/)

adrianphicks 08-01-2003 01:51 AM

Need to switch tty or send system msgs to tty2
 
We are testing a linux box as reader of barcodes for our timeclock.

I want the box to be able to come up in its working state if, for example, the power goes off & comes back on.

We're able to get it to log in automatically & run the PHP script that reads the barcodes, however system messages are sent to tty1 & this interferes with the PHP script that sends barcodes to the timeclock database.

Haven't yet been able to find an automated way to switch to tty2 so we can run the PHP script there. Anyone know how?

Or if we can send all the system messages to tty2 that would be fine also.

Adrian Hicks

slapNUT 08-01-2003 07:33 PM

agetty will alow you to specify an alternate file to run besides /sbin/login. So you can use that to run a program on another tty by editing the /etc/inittab file:

Example: I can bypass the login by making agetty run /bin/bash on tty2.
Code:

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/agetty -l /bin/bash 9600 tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

There is more info available in man agetty.

NOTE the baud rate is necessary, it will not work without it, but I just use 9600 as an example.


All times are GMT -5. The time now is 10:48 PM.