From owner-freebsd-questions Tue Sep 24 9:53:39 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5C48537B401 for ; Tue, 24 Sep 2002 09:53:38 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17A0543E77 for ; Tue, 24 Sep 2002 09:53:37 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk ([IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id g8OGrZC0024356; Tue, 24 Sep 2002 17:53:35 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id g8OGrLuA024355; Tue, 24 Sep 2002 17:53:21 +0100 (BST) Date: Tue, 24 Sep 2002 17:53:21 +0100 From: Matthew Seaman To: Jimmy Lantz Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Init & ttys(5) file = Keeping script alive? Message-ID: <20020924165321.GB17475@happy-idiot-talk.infracaninophi> References: <5.1.0.14.0.20020924143122.02c62e48@mail.lusidor.nu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.1.0.14.0.20020924143122.02c62e48@mail.lusidor.nu> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-11.2 required=5.0 tests=IN_REP_TO,REFERENCES,SPAM_PHRASE_02_03,USER_AGENT, USER_AGENT_MUTT version=2.41 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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