开发者

How to start a linux shell as from /etc/inittab

开发者 https://www.devze.com 2023-01-05 01:53 出处:网络
We used to have two entries in our /etc/inittab: ::sysinit:/etc/init.d/rcS ttyS0::respawn:-/bin/sh rcS is a shell script which normally starts our application, but in a special case we called \"ret

We used to have two entries in our /etc/inittab:

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

rcS is a shell script which normally starts our application, but in a special case we called "return" to terminate it which apparently le开发者_JAVA技巧ts the /bin/sh take over the tty as we got a shell prompt where we could do some maintenance.

Now the inittab looks like this:

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

We now start the shell by executing "/bin/bash -i" in the rcS script, as we don't want to always run a second shell (due to memory constraints) which is normally never used.

But the created bash doesn't feature job control, which is very limiting.

So my question is, can I create a shell (and maybe terminate the rcS script) the same way the init processed did in our previous solution so that I get again a shell with job control?


This depends on exactly what OS you are running. Here is an example which works on RHEL/CentOS.

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

Here is what someone else did for a similar trick.

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

精彩评论

暂无评论...
验证码 换一张
取 消