History log of /freebsd-10.3-release/usr.sbin/cron/cron/cron.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 261231 28-Jan-2014 ache

MFC: r261146

Bad timespec_subtract() calculations produce negative tv_nsec on i386
which cause EINVAL returned from nanosleep() which cause loop in
cron_sleep() and making all cron jobs to start about 30 seconds earlier
(which cause f.e. logfiles rotation by newsyslog delayed by 1 hour).

Use simple and proved calculations from kernel's timespecsub() instead.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 242101 25-Oct-2012 sobomax

Second attempt to add @every_second keyword support. Due to multiple
requests, default to the previous 60-seconds scheduling method
unless there is any @every_second entries to conserve CPU cycles and
power.

This change also improves scheduling in the default mode by running
as close to the beginning of the minnute as possible by replacing
sleep(3) with nanosleep(2). Previously, the tasks would run anywhere
within the first second of the minute and that offset drifted back
and forth each time cron(8) was engaged.

MFC after: 1 month


# 241672 18-Oct-2012 sobomax

Fully backout latest changes.

Pointy hat to: sobomax


# 241649 17-Oct-2012 sobomax

Revert latest changes to cron, until better version is worked out (I hope).

Requested by: few


# 241625 17-Oct-2012 sobomax

o Use nanosleep(2) to sleep exact amount of time till the next second,
not multiple of 1 second, which results in actual time to drift back
and forth every run within 1 second of the actual action has
been set for.

Suggested by: Ian Lepore

o Schedule the first run in 1 second after starting up, not on the
boundary of the next minute, which results in the every_second jobs
not being run.


# 241576 15-Oct-2012 sobomax

Add per-second scheduling into the cron(8). Right now it's
only available via the new @every_second shortcut. ENOTIME to
implement crontab(5) format extensions to allow more flexible
scheduling.

In order to address some concerns expressed by Terry Lambert
while discussing the topic few years ago, about per-second cron
possibly causing some bad effects on /etc/crontab by stat()ing
it every second instead of every minute now (i.e. atime update),
only check that database needs to be reloaded on every 60-th
loop run. This should be close enough to the current behaviour.

Add "@every_minute" shortcut while I am here.

MFC after: 1 month


# 241124 02-Oct-2012 pluknet

Fix build with DEBUGGING disabled.


# 199804 25-Nov-2009 attilio

Avoid sshd, cron, syslogd and inetd to be killed under high-pressure swap
environments.
Please note that this can't be done while such processes run in jails.

Note: in future it would be interesting to find a way to do that
selectively for any desired proccess (choosen by user himself), probabilly
via a ptrace interface or whatever.

Obtained from: Sandvine Incorporated
Reviewed by: emaste, arch@
Sponsored by: Sandvine Incorporated
MFC: 1 month


# 180096 29-Jun-2008 marck

Add -m option to cron(8), overriding default mail recipient for cron mails,
unless explicitly provided by MAILTO= line in crontab. This feature can be
useful in massive hosting environment, where most users do not care about
autogenerated mails.

Setting recipient to null string disables default mails at all.

Approved by: yar
MFC after: 4 weeks


# 173412 07-Nov-2007 kevlo

Cleanup of userland __P use


# 160521 20-Jul-2006 stefanf

Don't use "implicit int". Move the opening { of the functions to the next
line while there.


# 150214 16-Sep-2005 pjd

Pidfiles should be created with permission preventing users from opening
them for reading. When user can open file for reading, he can also
flock(2) it, which can lead to confusions.

Pointed out by: green


# 149430 24-Aug-2005 pjd

Use pidfile(3) in cron(8).

Note, that when cron(8) cannot create pidfile, it'll exit. I didn't
changed this behaviour, but its better to ignore errors other than
EEXIST, so daemon can be started on systems where /var/ file system
doesn't support locking (like NFS without rpc.lockd(8)).


# 129280 16-May-2004 yar

Add two new options to cron(8), -J and -j. They allow to specify
the maximum amount of time jitter for root and other users, respectively.
Before starting a job, cron(8) will sleep a random number of seconds,
from 0 to the amount specified. This can help to smooth down load spikes
when a lot of jobs are to start at the beginning of a particular minute
(e.g., the first minute of an hour.)

PR: bin/66474
Submitted by: Dmitry Morozovsky <marck <@> rinet.ru>


# 74010 09-Mar-2001 babkin

The new version of the daylight time saving support. This time it works
for any change of the time zone offset from GMT. To enable use the
option -s.


# 73955 07-Mar-2001 peter

Properly detach at startup. We could be passing revoked fd's to
child processes or starting children with no fd 0 (stdin) at all etc.
This is currently breaking on hub.freebsd.org.


# 71407 23-Jan-2001 babkin

Backed out the DST support changes.


# 71358 22-Jan-2001 babkin

Made the special handling of the daylight time switches optional,
enabled by the option "-s" (for dSt). This returned the default behavior
to its original form.

The new option name is not "-d" because that would cause associations with
"debug" and cron already has "-x" for debugging, so this would cause
confusion.


# 71301 20-Jan-2001 babkin

Added sensible handling of switch to and from daylight saving time
for the jobs that fall into the disappearing or duplicated time
interval.

PR: bin/24494


# 50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


# 41723 13-Dec-1998 dillon

PR: bin/5572

Prevent cron from going crazy if the time steps. For example, if you
have a system with hundreds of users and lots of different crontabs
and your time steps back an hour, the old cron would then attempt to
run an hours worth of cron jobs in a few seconds.


# 37450 06-Jul-1998 bde

Fixed printf format errors.


# 29452 15-Sep-1997 charnier

Use err(3). Rewrote man page in mdoc format.


# 24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 16859 30-Jun-1996 wosch

fix: debug flag 'test' cause endless loop
document debug flags

close PR bin/683


# 2312 27-Aug-1994 jkh

This commit was generated by cvs2svn to compensate for changes in r2311,
which included commits to RCS files with non-trunk default branches.


# 2311 27-Aug-1994 jkh

Paul Vixie's cron, version 3.0. Munged into bmake format. If this goes
well, expect our two seperate directories for cron and crontab to go away
shortly.
Submitted by: jkh