plugins/mod_cron.lua
changeset 11999 bbd3ac65640d
parent 11990 3d5135e8a2a7
child 12004 00c57684cf20
--- a/plugins/mod_cron.lua	Tue Nov 30 00:55:54 2021 +0100
+++ b/plugins/mod_cron.lua	Fri Dec 03 00:11:31 2021 +0100
@@ -21,6 +21,10 @@
 		task.save = save_task;
 		module:log("debug", "%s task %s added, last run %s", task.when, task.id,
 			task.last and require("util.datetime").datetime(task.last) or "never");
+		if task.last == nil and task.when == "daily" then
+			local now = os.time();
+			task.last = now - now % 86400;
+		end
 		return true
 	end