Forwarding, since it doesn't seem to have made it through.
---------- Forwarded message ----------
From: <[email protected]>
Date: Sun, Jan 10, 2016 at 3:04 PM
Subject: cron fails to reload if multiple files loaded in quick succession
To: [email protected]
Cc: [email protected]
>Synopsis: cron fails to reload if multiple files loaded in quick
succession
>Category: base
>Environment:
System : OpenBSD 5.9
Details : OpenBSD 5.9-beta (GENERIC) #1661: Tue Jan 5 13:07:34
MST 2016
[email protected]:
/usr/src/sys/arch/amd64/compile/GENERIC
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
Bug noticed when using sysutils/salt to manage crontab. When it replaces
an entry, it first loads a file with the entry removed, then another with
the proper entry added. Cron gets reloaded only on the first replace, not
on the second, thus the new entry never triggers as cron is not aware of
it.
>How-To-Repeat:
Let's take default root's cron (cron1) and one with 'date' set to run every
minute (cron2):
$ cat /tmp/cron1
#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday command
#
# rotate log files every hour, if necessary
0 * * * * /usr/bin/newsyslog
# send log file notifications, if necessary
#1-59 * * * * /usr/bin/newsyslog -m
#
# do daily/weekly/monthly maintenance
30 1 * * * /bin/sh /etc/daily
30 3 * * 6 /bin/sh /etc/weekly
30 5 1 * * /bin/sh /etc/monthly
#0 * * * * sleep $((RANDOM \% 1800)) &&
/usr/libexec/spamd-setup
$ cat /tmp/cron2
#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday command
#
# rotate log files every hour, if necessary
0 * * * * /usr/bin/newsyslog
# send log file notifications, if necessary
#1-59 * * * * /usr/bin/newsyslog -m
#
# do daily/weekly/monthly maintenance
30 1 * * * /bin/sh /etc/daily
30 3 * * 6 /bin/sh /etc/weekly
30 5 1 * * /bin/sh /etc/monthly
#0 * * * * sleep $((RANDOM \% 1800)) &&
/usr/libexec/spamd-setup
* * * * * date
Let's replace crontab with cron1, then immediately with cron2, and list
crontab:
# crontab -u root /tmp/cron1 ; crontab -u root /tmp/cron2 ; crontab -l
#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday command
#
# rotate log files every hour, if necessary
0 * * * * /usr/bin/newsyslog
# send log file notifications, if necessary
#1-59 * * * * /usr/bin/newsyslog -m
#
# do daily/weekly/monthly maintenance
30 1 * * * /bin/sh /etc/daily
30 3 * * 6 /bin/sh /etc/weekly
30 5 1 * * /bin/sh /etc/monthly
#0 * * * * sleep $((RANDOM \% 1800)) &&
/usr/libexec/spamd-setup
* * * * * date
But, /var/cron/log says:
Jan 10 14:02:12 OpenBSD-current-amd64 crontab[14066]: (root) REPLACE (root)
Jan 10 14:02:12 OpenBSD-current-amd64 cron[25975]: (root) RELOAD (root)
Jan 10 14:02:12 OpenBSD-current-amd64 crontab[32102]: (root) REPLACE (root)
Jan 10 14:02:12 OpenBSD-current-amd64 crontab[5535]: (root) LIST (root)
and 'date' will never run.
>Fix:
dmesg:
OpenBSD 5.9-beta (GENERIC) #1661: Tue Jan 5 13:07:34 MST 2016
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 520028160 (495MB)
avail mem = 500240384 (477MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (10 entries)
bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006
bios0: innotek GmbH VirtualBox
acpi0 at bios0: rev 2
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP APIC SSDT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2574.62 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,RDRAND,NXE,LONG,LAHF,ITSC
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: CPU supports MTRRs but not enabled by BIOS
cpu0: apic clock running at 999MHz
cpu0: mwait min=64, max=64
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 11, 24 pins
bus 0
extent `pcimem' (0x0 - 0xffffffffffffffff), flags=0
0x0 - 0x9ffff
0xc0000 - 0x1fffffff
0xffe00000 - 0xffffffffffffffff
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C1(@1 halt!)
acpibat0 at acpi0: BAT0 model "1" serial 0 type VBOX oem "innotek"
acpiac0 at acpi0: AC unit online
acpivideo0 at acpi0: GFX0
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel
0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <VBOX HARDDISK>
wd0: 128-sector PIO, LBA, 10240MB, 20971520 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
vga1 at pci0 dev 2 function 0 "InnoTek VirtualBox Graphics Adapter" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
em0 at pci0 dev 3 function 0 "Intel 82540EM" rev 0x02: apic 1 int 19,
address 08:00:27:0b:92:aa
"InnoTek VirtualBox Guest Service" rev 0x00 at pci0 dev 4 function 0 not
configured
piixpm0 at pci0 dev 7 function 0 "Intel 82371AB Power" rev 0x08: SMBus
disabled
em1 at pci0 dev 8 function 0 "Intel 82540EM" rev 0x02: apic 1 int 16,
address 08:00:27:b1:ee:71
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (9a76603a6693cfd4.a) swap on wd0b dump on wd0b
usbdevs:
usbdevs: no USB controllers found
--
viq