Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149801592
D19924.1790934949.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19924.1790934949.diff
View Options
Index: usr.sbin/cron/cron/database.c
===================================================================
--- usr.sbin/cron/cron/database.c
+++ usr.sbin/cron/cron/database.c
@@ -259,6 +259,8 @@
struct passwd *pw = NULL;
int crontab_fd = OK - 1;
user *u;
+ entry *e;
+ time_t now;
if (strcmp(fname, SYS_NAME) && !(pw = getpwnam(uname))) {
/* file doesn't have a user in passwd file.
@@ -307,6 +309,21 @@
u = load_user(crontab_fd, pw, fname);
if (u != NULL) {
u->mtime = statbuf->st_mtime;
+ /*
+ * TargetTime == 0 when we're initially populating the database,
+ * and TargetTime > 0 any time after that (i.e. we're reloading
+ * cron.d/ files because they've been created/modified). In the
+ * latter case, we should check for any interval jobs and run
+ * them 'n' seconds from the time the job was loaded/reloaded.
+ * Otherwise, they will not be run until cron is restarted.
+ */
+ if (TargetTime != 0) {
+ now = time(NULL);
+ for (e = u->crontab; e != NULL; e = e->next) {
+ if ((e->flags & INTERVAL) != 0)
+ e->lastexit = now;
+ }
+ }
link_user(new_db, u);
}
Index: usr.sbin/cron/crontab/crontab.5
===================================================================
--- usr.sbin/cron/crontab/crontab.5
+++ usr.sbin/cron/crontab/crontab.5
@@ -17,7 +17,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 15, 2019
+.Dd April 16, 2019
.Dt CRONTAB 5
.Os
.Sh NAME
@@ -248,9 +248,11 @@
a job that much seconds after completion of previous invocation of
the job.
Unlike regular syntax, it guarantees not to overlap two or more
-invocations of the same job.
+invocations of the same job during normal cron execution.
+Note, however, that overlap may occur if the job is running while the crontab
+is reloaded.
The first run is scheduled specified amount of seconds after cron
-has started.
+has loaded or reloaded the containing crontab.
.Sh EXAMPLE CRON FILE
.Bd -literal
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 9:55 AM (4 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30098271
Default Alt Text
D19924.1790934949.diff (1 KB)
Attached To
Mode
D19924: cron(8): schedule interval jobs that get loaded during execution
Attached
Detach File
Event Timeline
Log In to Comment