Cron is a time-based job scheduler in Linux. cron-js is daemon to execute scheduled commands using JavaScript on your webpage. The script depends on the local time of the operating system. Because it is running based on the web browser which running on client side. This script can make easier and more flexible development than server side script.
cron.add([date], [exec]);
-
date
- The time and date fields are
- minute: 0-59
- hour: 0-23
- day of month: 1-31
- month: 1-12
- day of week: 0-7 (0 is Sunday)
-
exec
- url or function
cron.add("`Minute` `Hour` `Day of month` `Month` `Day of week`", `Exec`);
cron.start(); // start cron
cron.stop(); // stop cron
cron.add("* * * * *", function() { console.log("exec"); });
cron.start();
cron.add("*/5 * * * *", function() { console.log("exec"); });
cron.start();
cron.add("*/5 * * * 0", function() { console.log("exec"); });
cron.start();
cron.add("* * * * *", "http://[YOURURL]");
cron.start();
cron-js is available under the terms of the MIT License.