From owner-freebsd-questions@FreeBSD.ORG Wed Sep 3 12:57:01 2003 Return-Path: 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 B514816A4BF for ; Wed, 3 Sep 2003 12:57:01 -0700 (PDT) Received: from out001.verizon.net (out001pub.verizon.net [206.46.170.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id A9B9C43FA3 for ; Wed, 3 Sep 2003 12:57:00 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com ([68.237.14.199]) by out001.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030903195559.XRTY1299.out001.verizon.net@mac.com>; Wed, 3 Sep 2003 14:55:59 -0500 Message-ID: <3F564740.5050704@mac.com> Date: Wed, 03 Sep 2003 15:55:44 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Banning References: <20030903194259.GA23225@skytrackercanada.com> In-Reply-To: <20030903194259.GA23225@skytrackercanada.com> X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at out001.verizon.net from [68.237.14.199] at Wed, 3 Sep 2003 14:55:59 -0500 cc: questions@freebsd.org Subject: Re: how to run a program as a daemon X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2003 19:57:01 -0000 David Banning wrote: > I am running tmda-ofmipd for my smtp server and occasionally > it dies. I wonder how I could set it up to run so that if it > dies for some reason, it will start up again. Right now, it > starts in my rc.local like so; > > /usr/local/bin/tmda-ofmipd -R imap://localhost -u tofmipd Look at DJB's daemontools, perhaps. But the general idea is that you have a monitor script which looks like: #! /bin/sh while : ; do /usr/local/bin/tmda-ofmipd -R imap://localhost -u tofmipd echo "TMDA daemon died! Restarting in 5 seconds..." sleep 5 done -- -Chuck