Solved Various forms of /etc/crontab ?

We have a number of jails running on several hosts. I was examining the /etc/crontab files and noted that the file contents differ slightly from jail to jail. Some have this:

Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: releng/12.3/usr.sbin/cron/cron/crontab 338497 2018-09-06 14:55:54Z brd $
#
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
#
#minute hour  mday  month wday  who command
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11  * * * *     operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0 * * * *         root  newsyslog
#
# Perform daily/weekly/monthly maintenance.

and some have this:

Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: releng/12.3/usr.sbin/cron/cron/crontab 338497 2018-09-06 14:55:54Z brd $
#
SHELL=/bin/sh
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
#
# Rotate log files every hour, if necessary.
0 * * * *           root  newsyslog
#
# Perform daily/weekly/monthly maintenance.

What is the significance of this difference and how or why was it introduced?
 
So the difference I'm seeing is addition of the "atrun" line and modification in the PATH, is that what you are talking about?

If so I would guess a package added to that specific jail caused it.
Are the jails all at the same patch level/release?
freebsd-version -kru
does that match on all of them?
 
If so I would guess a package added to that specific jail caused it.
Packages don't magically change /etc/crontab.

The one with atrun(8) (and the limited PATH) in it seems to stem from 11.x, while the one without is from 12.x.

11.x /etc/crontab:
Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: releng/11.4/etc/crontab 342103 2018-12-14 21:30:34Z imp $
#
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
#
#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
#
# Rotate log files every hour, if necessary.
0       *       *       *       *       root    newsyslog
#
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time.  See adjkerntz(8) for details.
1,31    0-5     *       *       *       root    adjkerntz -a

12.x /etc/crontab:
Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: releng/12.3/usr.sbin/cron/cron/crontab 338497 2018-09-06 14:55:54Z brd $
#
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
#
#minute hour    mday    month   wday    who     command
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11    *       *       *       *       operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0       *       *       *       *       root    newsyslog
#
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time.  See adjkerntz(8) for details.
1,31    0-5     *       *       *       root    adjkerntz -a

On 12.x atrun(8) actually moved to /etc/cron.d/at:
Code:
% cat /etc/cron.d/at
# $FreeBSD: releng/12.3/usr.bin/at/atrun 337626 2018-08-11 13:52:23Z brd $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin

# See crontab(5) for field format.
*/5     *       *       *       *       root    /usr/libexec/atrun

It doesn't matter if you have a /etc/cron.d/at or have it in /etc/crontab, as long as you don't have both.
 
This is interesting. All the jails have /etc/cron.d/at. This situation must have existed for quite some time if /etc/cron.d/at is an artifact from upgrading from 11 to 12.

What is the issue with having both?
 
I have fixed this by rewriting /etc/crotab for all jails.

But in dealing with this I have uncovered another problem for which I will start another thread.
 
Back
Top