From owner-freebsd-questions@FreeBSD.ORG Fri Jun 27 22:43:09 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 A90261065679 for ; Fri, 27 Jun 2008 22:43:09 +0000 (UTC) (envelope-from prvs=pschmehl_lists=0571e69c7@tx.rr.com) Received: from ip-relay-001.utdallas.edu (ip-relay-001.utdallas.edu [129.110.20.111]) by mx1.freebsd.org (Postfix) with ESMTP id 8714D8FC0A for ; Fri, 27 Jun 2008 22:43:09 +0000 (UTC) (envelope-from prvs=pschmehl_lists=0571e69c7@tx.rr.com) X-Group: RELAYLIST X-IronPort-AV: E=Sophos;i="4.27,717,1204524000"; d="scan'208";a="2810908" Received: from smtp3.utdallas.edu ([129.110.20.110]) by ip-relay-001.utdallas.edu with ESMTP; 27 Jun 2008 17:13:36 -0500 Received: from utd65257.utdallas.edu (utd65257.utdallas.edu [129.110.3.28]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp3.utdallas.edu (Postfix) with ESMTPSA id BB08823DF2; Fri, 27 Jun 2008 17:13:36 -0500 (CDT) Date: Fri, 27 Jun 2008 17:13:37 -0500 From: Paul Schmehl To: David Allen , freebsd-questions@freebsd.org Message-ID: <07381373DD6D926F9F27DC91@utd65257.utdallas.edu> In-Reply-To: <2daa8b4e0806271411p709ad002o3137c7eb4ff53bac@mail.gmail.com> References: <2daa8b4e0806271411p709ad002o3137c7eb4ff53bac@mail.gmail.com> X-Mailer: Mulberry/4.0.6 (Linux/x86) X-Munged-Reply-To: Figure it out MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: Subject: Re: rc scripts X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Paul Schmehl List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2008 22:43:09 -0000 --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. -- Paul Schmehl As if it wasn't already obvious, my opinions are my own and not those of my employer.