Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2012 13:10:27 -0400
From:      Glen Barber <gjb@FreeBSD.org>
To:        David Wolfskill <david@catwhisker.org>
Cc:        rc@freebsd.org
Subject:   Re: rc.d/cron appears to ignore rcvar "cron_program" -- intentional?
Message-ID:  <20120906171027.GC1332@glenbarber.us>
In-Reply-To: <20120906170101.GV1486@albert.catwhisker.org>
References:  <20120906170101.GV1486@albert.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120906171027.GC1332>