From 043b080e33511355bd797c4408b05971eb352503 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 18 May 2017 06:33:55 +0000 Subject: [PATCH] Conditionally handle the crontab entry for atrun(8) The default crontab prior to this commit assumes atrun(8) is always present, which isn't true if MK_AT == no. Move atrun(8) execution from /etc/crontab to /etc/cron.d/at, and base /etc/cron.d/at's installation on MK_AT. cron(8) will detect /etc/cron.d/at's presence when the configuration is loaded and run atrun every 5 minutes like it would prior to this commit. SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at because atrun(8) executes programs, which may rely on environment set in the current default /etc/crontab. Noted by: bdrewery (in an internal review) MFC after: 2 months Relnotes: yes (may need to add environmental modifications to /etc/cron.d/at) Sponsored by: Dell EMC Isilon --- etc/Makefile | 1 + etc/cron.d/Makefile | 11 +++++++++++ etc/cron.d/at | 7 +++++++ etc/crontab | 2 -- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 etc/cron.d/Makefile create mode 100644 etc/cron.d/at diff --git a/etc/Makefile b/etc/Makefile index 8bfeac2b6b9..4b117d5257d 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -8,6 +8,7 @@ FILESGROUPS= FILES # No need as it is empty and just causes rebuilds since this file does so much. UPDATE_DEPENDFILE= no SUBDIR= \ + cron.d \ newsyslog.conf.d \ syslog.d diff --git a/etc/cron.d/Makefile b/etc/cron.d/Makefile new file mode 100644 index 00000000000..3ddc5fb438a --- /dev/null +++ b/etc/cron.d/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +.if ${MK_AT} != "no" +FILES+= at +.endif + +BINDIR= /etc/cron.d + +.include diff --git a/etc/cron.d/at b/etc/cron.d/at new file mode 100644 index 00000000000..61fe5a8431a --- /dev/null +++ b/etc/cron.d/at @@ -0,0 +1,7 @@ +# $FreeBSD$ +# +SHELL=/bin/sh +PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin + +# See crontab(5) for field format. +*/5 * * * * root /usr/libexec/atrun diff --git a/etc/crontab b/etc/crontab index e1e6e8862c8..a3248dabeb5 100644 --- a/etc/crontab +++ b/etc/crontab @@ -7,8 +7,6 @@ PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin # #minute hour mday month wday who command # -*/5 * * * * root /usr/libexec/atrun -# # Save some entropy so that /dev/random can re-seed on boot. */11 * * * * operator /usr/libexec/save-entropy #