How to run linux shell as from / etc / inittab

We used two entries in our / etc / inittab:

::sysinit:/etc/init.d/rcS ttyS0::respawn:-/bin/sh 

rcS is a shell script that usually starts our application, but in a special case we call "return" to end it, which apparently allows / bin / sh to take over tty, since we got a shell prompt, do some service.

Now inittab looks like this:

 ::once:/etc/init.d/rcS 

Now we start the shell by executing "/ bin / bash -i" in the rcS script, since we do not want to always run the second shell (due to memory limitations), which is usually never used.

But the created bash does not support job management, which is very limiting.

So my question is: can I create a shell (and possibly finish the rcS script) in the same way that I processed init in our previous solution so that I get a shell with job management again?

+4
source share
1 answer

It depends on which OS you are running. Here is an example that works on RHEL / CentOS.

 6:2345:respawn:/sbin/mingetty --autologin root tty6 

This is what the other person did for such a trick.

 openvt -f -c 12 -w -- sh -c "unicode_start; echo -e '$NORPT'; exec $LOGINSH" >/dev/tty1 
+4
source

Source: https://habr.com/ru/post/1314336/


All Articles