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.
This commit is contained in:
parent
7d39b1e3be
commit
be821963c1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71358
@ -25,6 +25,7 @@
|
||||
.Nd daemon to execute scheduled commands (Vixie Cron)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl s
|
||||
.Op Fl x Ar debugflag Ns Op ,...
|
||||
.Sh DESCRIPTION
|
||||
.Nm Cron
|
||||
@ -69,10 +70,16 @@ need not be restarted whenever a crontab file is modified. Note that the
|
||||
command updates the modtime of the spool directory whenever it changes a
|
||||
crontab.
|
||||
.Pp
|
||||
Available options:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl s
|
||||
Enable special handling of the switching between the standard time and
|
||||
daylight saving time.
|
||||
.Pp
|
||||
If the time zone has daylight saving time which differs by one hour from
|
||||
the standard time and the switch to and from daylight saving time occurs
|
||||
at :00 minutes (as in most of Asia, Europe and North America) then these
|
||||
time switches are handled specially by
|
||||
at :00 minutes (as in most of the world with very few exceptions) then these
|
||||
time switches would be handled specially by
|
||||
.Nm cron .
|
||||
The time zones with other variations of daylight saving time (such as with
|
||||
30 minutes difference or switched at :30 minutes etc.) do not have such
|
||||
@ -95,6 +102,7 @@ during the switch to daylight saving time, such jobs are
|
||||
executed during the next hour at the first minute that is specified
|
||||
for them in
|
||||
.Xr crontab 5 .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr crontab 1 ,
|
||||
.Xr crontab 5
|
||||
|
@ -45,12 +45,13 @@ static void usage __P((void)),
|
||||
parse_args __P((int c, char *v[]));
|
||||
|
||||
static time_t last_time = 0;
|
||||
static int dst_enabled = 0;
|
||||
|
||||
static void
|
||||
usage() {
|
||||
char **dflags;
|
||||
|
||||
fprintf(stderr, "usage: cron [-x debugflag[,...]]\n");
|
||||
fprintf(stderr, "usage: cron [-s] [-x debugflag[,...]]\n");
|
||||
fprintf(stderr, "\ndebugflags: ");
|
||||
|
||||
for(dflags = DebugFlagNames; *dflags; dflags++) {
|
||||
@ -186,8 +187,9 @@ cron_tick(db)
|
||||
* we support only change by +-1 hour happening at :00 minutes,
|
||||
* those living in more strange timezones are out of luck
|
||||
*/
|
||||
if (last_time != 0 && tm->tm_isdst != lasttm.tm_isdst
|
||||
&& TargetTime > last_time /* exclude stepping back */) {
|
||||
if (dst_enabled && last_time != 0
|
||||
&& TargetTime > last_time /* exclude stepping back */
|
||||
&& tm->tm_isdst != lasttm.tm_isdst ) {
|
||||
int prevhr, nexthr, runtime;
|
||||
int lastmin, lasthour;
|
||||
int trandom, tranmonth, trandow;
|
||||
@ -432,8 +434,11 @@ parse_args(argc, argv)
|
||||
{
|
||||
int argch;
|
||||
|
||||
while ((argch = getopt(argc, argv, "x:")) != -1) {
|
||||
while ((argch = getopt(argc, argv, "sx:")) != -1) {
|
||||
switch (argch) {
|
||||
case 's':
|
||||
dst_enabled = 1;
|
||||
break;
|
||||
case 'x':
|
||||
if (!set_debug_flags(optarg))
|
||||
usage();
|
||||
|
Loading…
Reference in New Issue
Block a user