Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP function that receive a cron string and return the next run timestamp

I need to develop a task system that should be able to work on servers that doesn't support crontab.

I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run.

If such a code couldn't be found then how should I start with that?

like image 601
xun Avatar asked Jan 03 '11 19:01

xun


People also ask

How do I check the next cron time?

Listing Cron Jobs in Linux You can find them in /var/spool/cron/crontabs. The tables contain the cron jobs for all users, except the root user. The root user can use the crontab for the whole system. In RedHat-based systems, this file is located at /etc/cron.

What does cron 0 * * * * * mean?

*/5 * * * * Execute a cron job every 5 minutes. 0 * * * * Execute a cron job every hour.

What is cron expression generator?

A cron expression is a string that represents a set of times at which a task will be executed. The expression comprises six fields: second(0-59), minute(0-59), hour(0-23), day of month(1-31), month(1-12 or JAN-DEC), and day of week(0-6 or SUN-SAT).

What is use of cron job in PHP?

The App Engine Cron Service allows you to configure regularly scheduled tasks that operate at defined times or regular intervals. These tasks are commonly known as cron jobs.


1 Answers

You could use this class PHP-Parse-cron-strings-and-compute-schedules

It'll also compute the last scheduled run

like image 124
berebidahoo Avatar answered Nov 03 '22 13:11

berebidahoo