Somk
Somk

Reputation: 12047

Php Predefined scheduled tasks Cron?

I want to create a script that runs at scheduled times and posts new content to my website. But the times it should run are not consistent. I may want to post data on a monday at 9am then tuesday at midday and so forth.

I was thinking of creating a database and each piece of content can be saved into that with a display time. Then creating a cron to run every hour and check if any new content should be added can determine what is output.

Although this seems like a intensive overly complicated approach.

Are there any ways to run a cron once on a particular data and time?

Upvotes: 0

Views: 88

Answers (2)

KingCrunch
KingCrunch

Reputation: 131811

You could add a publishedAt-column and extend your query, so that it will return only results, where NOW() >= publishedAt.

Upvotes: 1

Related Questions