From owner-freebsd-questions@FreeBSD.ORG Mon Jun 30 11:01:31 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1153310656AA for ; Mon, 30 Jun 2008 11:01:31 +0000 (UTC) (envelope-from the.real.david.allen@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id BF1D68FC18 for ; Mon, 30 Jun 2008 11:01:30 +0000 (UTC) (envelope-from the.real.david.allen@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so638521ywe.13 for ; Mon, 30 Jun 2008 04:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=vVd02XIyldzEFqhYWcRn3nPu20yCcOxHYJKSow2LMdo=; b=AqdMWyTgN4a98kTI3GNXUMpSpz9vLjV1mll/ApNDzXa0m4SITHPjhloUidCZUM98jV pXNKF8tBc2mxhQT3QhI7OSyh110no2ptmzUAaipWCNSI28h0CrlkzD3/s8Gei0IZ4ESc oSf3jxJDcFH7h0huZj8w4eeDE6g/st6/+9yfI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=fOA1KTpjNre6hiQWvvmAVm2fAoFtjl6U/+4ZjTpJVj2+E/2hlruwMvw+VtjJLZlDZ1 Vw5OJu3rQmuQuIxSfrl+kURdOrFpWEh29J1hMlS5OXW+CXjTYteS1gZ3NO9nrMJWj9Cx 6na4FaxqQTmmpcDFBLWvfjB7bGu1Uq+nrdOzI= Received: by 10.151.114.9 with SMTP id r9mr8226595ybm.147.1214823686665; Mon, 30 Jun 2008 04:01:26 -0700 (PDT) Received: by 10.151.111.10 with HTTP; Mon, 30 Jun 2008 04:01:26 -0700 (PDT) Message-ID: <2daa8b4e0806300401i4b3319bay88cf2ce24c6278f7@mail.gmail.com> Date: Mon, 30 Jun 2008 04:01:26 -0700 From: "David Allen" To: freebsd-questions@freebsd.org In-Reply-To: <07381373DD6D926F9F27DC91@utd65257.utdallas.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2daa8b4e0806271411p709ad002o3137c7eb4ff53bac@mail.gmail.com> <07381373DD6D926F9F27DC91@utd65257.utdallas.edu> Subject: Re: rc scripts X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2008 11:01:31 -0000 On 6/27/08, Paul Schmehl wrote: > --On Friday, June 27, 2008 14:11:55 -0700 David Allen > wrote: > >> I need to an '-s' flag to the execution of openntpd's rc script: >> >> # PROVIDE: openntpd >> # REQUIRE: DAEMON >> # BEFORE: LOGIN >> # KEYWORD: nojail >> >> . /etc/rc.subr >> >> name=openntpd >> rcvar=`set_rcvar` >> command=/usr/local/sbin/ntpd >> required_files=/usr/local/etc/ntpd.conf >> openntpd_enable=${openntpd_enable:-"NO"} >> load_rc_config $name >> run_rc_command "$1" >> >> The problems I'm having are multiple. First, the program doesn't offer >> any logging, and running it with the "do not daemonize" switch with >> >> # /usr/local/sbin/ntpd -d 2>&1 > logfile >> >> yields no output. >> >> Then, I'm not sure I understand everything I'm reading in rc.subr(8), but >> from trial error, I've discovered that modifying the script's "command" >> variable doesn't work, nor does adding the usual "scriptname_flags" >> directive to /etc/rc.conf. > > Scriptname_flags doesn't work because the port maintainer didn't write the > startup script so that it parses rc.conf for variables. You can edit the > script like this: > > command_args="-s" > > When rc.subr runs scripts, it runs them like this: > > ${command} ${command_args} ${command_flags} > > Or you can add this to the startup script and then use flags in rc.conf: > load_rc_config openntpd > > openntpd_flags=${openntpd_flags:-""} > > (In that order.) > > Then place openntpd_flags="-s" in rc.conf. > > Just remember that every time the port is updated, your changes will be > overwritten, so you'll need to make a backup or leave a note to yourself > somewhere so you remember to alter the new script. Thanks for that explanation. I've since discovered that the "sync on start" doesn't really work (at least in the same time frame that ntpd does) anyway, so I'll have to resort to running 'ntpd -gq' at system startup, and then run OpenBSD's ntpd daemon after the fact. At least I've something about the rc system.