Denys Vlasenko wrote:
On Thu, Oct 29, 2009 at 2:40 PM, Detlef Vollmann <[email protected]> wrote:
Denys Vlasenko wrote:
You want to run a shell on console when there is a console.
Your problem is, when there is no console, you *still*
run a shell but it exits and gets repeatedly restarted.
So how would you specify this in busybox inittab?
You don't specify it in inittab. If you use
::respawn:/bin/sh
Ok, understood.
Ladislav proposes to open them to /dev/tty0 instead.
Why? And why /dev/tty0, not, say, /dev/ttyS0?
I think he can easily achieve this by replacing
'console= ' in the kernel boot args by 'console=/dev/tty0'.
My initial reaction was 'just don't use busybox init',
but of course that's not always an option.
Sorry, this was a red herring.
I was under the assumption that in SysV init a line like
'S1:3:respawn:/sbin/mgetty -x0 -D ttyS1'
would prevent mgetty from being started if tty'S1' is not
available. But it's always started but just blocks
if no real device is attached to ttyS0.
Sorry about that.
Maybe check whether stdin is a tty, and only then run sh,
otherwise sleep forever:
::respawn:/bin/run_sh_if_tty.sh
where run_sh_if_tty.sh is
#!/bin/sh
while ! tty >/dev/null 2>&1; do sleep 3600; done
exec sh "$@"
Though 'sleep 3600' looks a bit hackish to me, I like this.
Thanks,
Detlef
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox