From owner-freebsd-questions@FreeBSD.ORG Tue Mar 15 06:19:26 2005 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 C6B1F16A4CE for ; Tue, 15 Mar 2005 06:19:26 +0000 (GMT) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6024943D62 for ; Tue, 15 Mar 2005 06:19:25 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b168.otenet.gr [212.205.244.176]) j2F6J1Rb014495; Tue, 15 Mar 2005 08:19:03 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.3/8.13.3) with ESMTP id j2F6JKTB042755; Tue, 15 Mar 2005 08:19:21 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.3/8.13.3/Submit) id j2F6JH7n042754; Tue, 15 Mar 2005 08:19:17 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Tue, 15 Mar 2005 08:19:17 +0200 From: Giorgos Keramidas To: Doug Poland Message-ID: <20050315061917.GB42670@gothmog.gr> References: <20050314215615.GM65944@polands.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050314215615.GM65944@polands.org> cc: freebsd-questions@freebsd.org Subject: Re: rc.subr startup question 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: Tue, 15 Mar 2005 06:19:26 -0000 On 2005-03-14 15:56, Doug Poland wrote: > Hello, > > I'm running 5.3-STABLE and I want to write a startup script for > ports/sysutils/mcron. The twis is, I want an mcron process for > each user I specify in an external file. For example... > > /usr/local/etc/mcron.conf: > $usernames="user1 user2 user3" > > /usr/local/etc/rc.d/mcron.sh > #!/bin/sh > > # $Id$ > > # PROVIDE: mcron > # REQUIRE: LOGIN > # KEYWORD: FreeBSD shutdown > # > . /etc/rc.subr > > name="mcron" > prefix=/usr/local > command=${prefix}/bin/${name} > mcron_enable=${mcron_enable:-"NO"} > mcron_flags=${mcron_flags-"-d"} > > # Load user names from conf file > # > . ${prefix}/etc/${name}.conf > > rcvar=`set_rcvar` > > load_rc_config $name > > for user in ${usernames}; do > mcron_user=${user} > run_rc_command "$1" > done > This does not work because run_rc_command checks to see if the process > is already running before attempting to launch another instance. Are you, by any chance, setting $pidfile to anything that is not shown above? The check_pidfile() check is disabled when $pidfile is empty. > Perhaps this is something best accomplished in /etc/rc.local? Probably.