Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 2002 17:53:21 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Jimmy Lantz <jimmy.lantz@lusidor.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Init & ttys(5) file = Keeping script alive?
Message-ID:  <20020924165321.GB17475@happy-idiot-talk.infracaninophi>
In-Reply-To: <5.1.0.14.0.20020924143122.02c62e48@mail.lusidor.nu>
References:  <5.1.0.14.0.20020924143122.02c62e48@mail.lusidor.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 24, 2002 at 02:51:47PM +0200, Jimmy Lantz wrote:

> "Init can also be used to keep arbitrary daemons running, automatically 
> restarting them if they die. In this case, the first field in the ttys(5) 
> file must not reference the path to a configured device node and will be 
> passed to the daemon as the final argument on its command line. This is 
> similar to the facility offered in the AT&T System V UNIX /etc/inittab."
> 
> Could anyone point me to a howto or supply a example line since neither 
> handbook nor faq mentions how just how to use getty.

Something like this added to /etc/ttys should do what you want:

    --	"/usr/local/bin/yourscript --arg=1"	unknown	on

which means that your script will be called with the command line:

    /usr/local/bin/yourscript --arg=1 --

You can apparently put whatever you want as the first column in
/etc/ttys --- there seems to be no requirement that the field contain
an actual device name.  However, as the position in the /etc/ttys file
affects the corresponding record number in /var/run/utmp (utmp(5))
it's probably best to add your modifications to the end of the ttys
file.

Nb. it's essential that your script doesn't try to daemonize by
forking itself, or init(8) will get very upset.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
                                                      Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020924165321.GB17475>