LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   TTY Console and pppd on same ttyS (https://www.linuxquestions.org/questions/linux-software-2/tty-console-and-pppd-on-same-ttys-928214/)

yplasse 02-07-2012 08:33 PM

TTY Console and pppd on same ttyS
 
Depending on the presence of a file, I want to either enable pppd or set a console on ttyS3. I installed the following script code in rc.local to attempt to do it:

ADIEXEC="/home/adi/exec"
if [ -f $ADIEXEC/RECOVERY.MOD ];
then
echo --- RECOVERY mode: ttyS3 is set as Serial Console
/sbin/agetty -L ttyS3 9600 vt100
else
if [ -f $ADIEXEC/TSTNORMA.MOD ]
then
echo --- TEST NORNAL mode: ttyS3 is used for PPP link
else
echo --- NORMAL mode: ttyS3 is used for PPP link
fi
pppd
fi

When I am in 'Recovery' mode, an attempt is made to run agetty. The boot sequence hangs but I am able to log on ttyS3. Normally agetty is run with inittab.

Is there a way to enable a serial console depending on a condition like above?

Thank you, Yves Plasse.

yplasse 02-08-2012 12:25 PM

I found a way to solve this problem. Apparently, it looks that the runlevel 2 is user definable on Slackware. According to some remarks in inittab, it is configured as the default runlevel 3. If I assign only the priority 2 to S2 for ttyS3 like the following, this one would be assigned as a serial console only at this RunLevel.

S2:2:respawn:/sbin/agetty -L ttyS3 9600 vt100

In rc.local, I can change the runlevel and ask init to review inittab when I discover that I am in recovery mode as following:

if [ -f $ADIEXEC/RECOVERY.MOD ];
then
echo --- RECOVERY mode: ttyS3 is set as Serial Console
init 2
else
...

Yves Plasse.


All times are GMT -5. The time now is 07:19 PM.