Scheduled Jobs

Permalink
For a website I need to build a system that's is able to read a mail to publish it's content. So i want to build a job that reads mail via POP/IMAP.

This Job has to run let's say each hour. How can i configure the scheduled jobs to do so?

Or is a scheduled job only runable from the dashboard. If so, why is it called a scheduled job?

MissMarvels
 
Mnkras replied on at Permalink Reply
Mnkras
well to get the emails you would need a script run by cron that every hour retrieves the emails and lets say make an xml file. you will have to make a block that reads the xml file and parses it.

this is almost like rss actually
MissMarvels replied on at Permalink Reply
MissMarvels
I know about cron, i'm not sure my provider let's me. But i expect a scheduled job (that's the name of the functionality) te be a scheduled job.

Is there an other way, using concrete5 or php to do so??
bikelane replied on at Permalink Reply
I actually had the same question: in Concrete5, what is a "scheduled job?" Is it a batch job that can be scheduled to run automatically on a periodic basis (a la cron)? If so, how can I specify the schedule for a job?
ScottC replied on at Permalink Reply
ScottC
there's also the nontab package/plug-in that runs that stuff for you. No idea how it works.
jordanlev replied on at Permalink Reply
jordanlev
Huh, never noticed that before. Here's the link if you want to try it:
http://www.concrete5.org/marketplace/addons/nontab-scheduler/...

That's pretty clever, looks like it works by firing on the "on_render_complete" event, which means that every time a page is viewed in your site, it checks if it is time to run the scheduled jobs again. This means that if you wanted to run jobs once per hour but nobody viewed your site until 5 hours later, the job would run when the site was viewed 5 hours later, not at the original 1 hour setting. But this isn't that big a deal I guess because if no one is viewing the site then why does it matter if the maintenance jobs are run or not?
Note that this may potentially cause your page loads to slow down, depending on how often you want the jobs to run and how complicated the scheduled task is.
ScottC replied on at Permalink Reply
ScottC
that makes sense. I'd probably tie into on_page_add if that one exists or any sort of update. No point in running a sitemap or search index job if your site doesn't change :) Would fire less often. Another one would be whenever an admin logs in or something. I know that event (login) exists :)
jordanlev replied on at Permalink Reply
jordanlev
Depending on the job, yes I would not do it on every page load. But I understand why the author of that add-on did it that way -- because he wanted it to be generalizable for any kind of task, not just sitemap/search index ones.
That's actually a great add-on for looking at the code, because it contains examples of how to hook into events, how to install dashboard pages, how to save and retrieve settings ($pkg->saveConfig) instead of creating a whole table in the database. Glad you pointed it out!
jordanlev replied on at Permalink Reply
jordanlev
I believe the "scheduled jobs" in the concrete5 dashboard are just jobs that should be run on some scheduled basis -- concrete5 doesn't actually do that scheduling. Usually these things are always done by cron. But if you say that your server doesn't allow you to set up cron jobs, there are other ways to do this -- the URL that concrete5 provides you can be run by any scheduling program on any system on any computer (cron on your local machine or another server, adTempus on MS Windows, maybe a macro you write on your desktop machine -- whatever) -- just have that scheduled job call the URL that concrete5 gives you in the dashboard (if on a unix command line system, have it run "curl", if on your desktop machine or on windows, just have it open up a web browser to that address), and that will cause all of the "scheduled jobs" in the concrete5 dashboard list to be run.

-Jordan