Re: getty replacement

From: Brian Candler <B.Candler_at_pobox.com>
Date: Tue, 5 Jul 2005 13:12:05 +0100
On Tue, Jul 05, 2005 at 12:45:01PM +0200, Marcin Jessa wrote:
> > On 2005-07-05 11:52, Marcin Jessa <lists_at_yazzy.org> wrote:
> > > Hi guys.
> > >
> > > Is there any way to replace "/usr/libexec/getty Pc"  with a custom
> > > application and what would be requirements for such an app?
> > > Running
> > > ttyv0 "/some/app/shell_code.sh Pc" cons23 on secure
> > > gives me:
> > > init: getty repeating too quickly on port /dev/ttyv0, sleeping 30 secs
> > > and my code is not executed.
> > 
> > Your shell script exits immediately, which leads init to believe
> > something caused it to exit prematurely.  Shell scripts that don't
> > exit, but continue working until they are explicitly terminated with
> > a signal should work fine.
> 
> That unfortunatelly does not seem to work.
> I tried a shell script with a read -p "Blah blah"  my_choice 
> which should wait for an execution but this did not work either giving me exactly the same message...

Well, here's a working example, which you can use as a starting point.

bloodhound:~# ls -l /var/tmp/myscript.sh 
-rwxr-xr-x  1 root  wheel  19 Jul  5 13:09 /var/tmp/myscript.sh
bloodhound:~# cat /var/tmp/myscript.sh 
#!/bin/sh
sleep 60
bloodhound:~# grep test /etc/ttys
test    /var/tmp/myscript.sh    cons25 on secure
bloodhound:~# kill -1 1
bloodhound:~# ps auxww | grep mysc
root     25581  0.0  0.4  1640   984  ??  I     1:10PM   0:00.00 /bin/sh /var/tmp/myscript.sh test
bloodhound:~# 

Tested under FreeBSD 5.4. After 60 seconds, when the shell script exits, a
new one is spawned by init:

bloodhound:~# ps auxww | grep mysc
root     25609  0.0  0.4  1640  1024  ??  S     1:11PM   0:00.00 /bin/sh /var/tmp/myscript.sh test

HTH,

Brian.
Received on Tue Jul 05 2005 - 10:12:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:38 UTC