From owner-freebsd-rc@FreeBSD.ORG Thu Sep 6 17:10:37 2012 Return-Path: Delivered-To: rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B752106564A; Thu, 6 Sep 2012 17:10:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 546178FC12; Thu, 6 Sep 2012 17:10:37 +0000 (UTC) Received: from glenbarber.us (unknown [IPv6:2001:470:8:1205:2:2:0:100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id A5D6B23F645; Thu, 6 Sep 2012 13:10:31 -0400 (EDT) Date: Thu, 6 Sep 2012 13:10:27 -0400 From: Glen Barber To: David Wolfskill Message-ID: <20120906171027.GC1332@glenbarber.us> References: <20120906170101.GV1486@albert.catwhisker.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hoZxPH4CaxYzWscb" Content-Disposition: inline In-Reply-To: <20120906170101.GV1486@albert.catwhisker.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: rc@freebsd.org Subject: Re: rc.d/cron appears to ignore rcvar "cron_program" -- intentional? X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 17:10:37 -0000 --hoZxPH4CaxYzWscb Content-Type: multipart/mixed; boundary="iFRdW5/EC4oqxDHL" Content-Disposition: inline --iFRdW5/EC4oqxDHL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi David, On Thu, Sep 06, 2012 at 10:01:01AM -0700, David Wolfskill wrote: > I was poking around to see if I could find a reasonable way to set the > UNAME_r environment variable for an instance of cron(8) running in a > jail (so that cron-initiated tasks could automagically inherit the > value, without requiring that every crontab instance within the > jail specify it), and I started to think about ways to coerce the > cron_program variable from /etc/defaults/rc.conf: >=20 > d134(8.3-S)[2] grep cron defaults/rc.conf=20 > cron_enable=3D"YES" # Run the periodic job daemon. > cron_program=3D"/usr/sbin/cron" # Which cron executable to run (if enab= led). > cron_dst=3D"YES" # Handle DST transitions intelligently (YES/NO) > cron_flags=3D"" # Which options to pass to the cron daemon. > entropy_dir=3D"/var/db/entropy" # Set to NO to disable caching entropy vi= a cron. > d134(8.3-S)[3]=20 >=20 > to set the environment variable. >=20 > But inspection of rc.d/cron shows: >=20 > d134(8.3-S)[6] grep cron_program rc.d/cron ; echo $? > 1 Can you please try the attached patch? Glen --iFRdW5/EC4oqxDHL Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cron-rc.diff.txt" Content-Transfer-Encoding: quoted-printable Index: etc/rc.d/cron =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- etc/rc.d/cron (revision 240152) +++ etc/rc.d/cron (working copy) @@ -12,10 +12,11 @@ =20 name=3D"cron" rcvar=3D"cron_enable" -command=3D"/usr/sbin/${name}" pidfile=3D"/var/run/${name}.pid" =20 load_rc_config $name +command=3D${cron_program:-/usr/sbin/${name}} + if checkyesno cron_dst then cron_flags=3D"$cron_flags -s" --iFRdW5/EC4oqxDHL-- --hoZxPH4CaxYzWscb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQSNkDAAoJEFJPDDeguUajh3oIALJPSr81aMjStLcgGPICgXDU 12IQuWVVqXS2Nrtlu+opuC9l4TT0DR2sWHjyG0ERkz7Cn9n74ms/wnDryp1qUtUw InS8MepoBZ0YZ08MIRaA+e1Zx1acEnhqoRZb+/7m33XPaEvLiKWQvMdSNe59TSL9 zVb5eONWO5BvBfW7OXHhiXxcP+H32N/uZQpCoCi2HWF8gTdQm3/6udLC84fUsNzO +R8UxFLUkoBcLpkjuHHt+gfhFOCmDX+LcmvtXqm5aPCKIV8t/GRSarH+dOTLsrlJ GTmOFnzMiiLVn9ok7Z/BeezMfa3QvmJ6ynqV0ab9RpklorBAg9dGKXmg3Rj1ghA= =IRuy -----END PGP SIGNATURE----- --hoZxPH4CaxYzWscb--